Skip to content

Regression: ParentIterator/AppendIterator/CallbackFilterIterator — rewind() throws LogicException (ext/spl/spl_iterators.c) #13211

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Several IteratorIterator subclasses beyond InfiniteIterator/NoRewindIterator (#13170) throw LogicException: Iterator wrapper state missing on rewind() instead of delegating to the inner iterator (or cleanly reporting invalid on empty iterators).

Class / scenario Zend 8.2 VM (today)
ParentIterator on RecursiveArrayIterator rewind() → valid LogicException ❌
AppendIterator (empty, no attached iterators) rewind() → valid() false LogicException ❌
CallbackFilterIterator on empty ArrayIterator rewind() → valid() false LogicException ❌

Same missing inner-iterator attachment pattern as #13123 / #13170.

php-src reference

PHP implementation target

  • ext/spl/ iterator wrapper builtins — wire inner iterator state on construct/rewind
  • PHP-in-PHP first — shared wrapper helper in PHP; thin VM dispatch only

Repro (verified 2026-06-28)

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_parentiterator_rewind.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_parentiterator_rewind.php'
# LogicException: Iterator wrapper state missing

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_appenditerator_empty_rewind.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_appenditerator_empty_rewind.php'

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_callbackfilteriterator_empty_rewind.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_callbackfilteriterator_empty_rewind.php'

Done when (php-src-strict)

Verification

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_parentiterator_rewind.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_appenditerator_empty_rewind.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_callbackfilteriterator_empty_rewind.php'

Links

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 28, 2026
  2. PurHur commented on Jun 28, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-C — batch (issues #12588, #12598, #13135, #13211)

  3. PurHur commented on Jun 28, 2026

    @PurHur
    OwnerAuthor

    Merged via #13225 — CallbackFilterIterator, ParentIterator, AppendIterator builtins registered; all three repro scripts print ok.

  4. PurHur commented on Jun 28, 2026

    @PurHur
    OwnerAuthor

    claim released: worker-lane-C — batch complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions