Skip to content

Regression: AOT LimitIterator/AppendIterator fail — missing __generator_resume metadata (ext/spl/spl_iterators.c) #26825

Description

@PurHur

Category

bug · php-src-strict · stdlib · user-script AOT · pillar 4

Problem

LimitIterator / AppendIterator / RegexIterator wrapping ArrayIterator match Zend on VM/JIT (iterator_to_array output correct), but user-script AOT aborts with Generator missing __generator_resume metadata in JIT (exit 2, no binary).

Distinct from #26785 (IteratorAggregate segfault after build) — these fail before emit completes.

Probed 2026-08-02 @ 2a36d3a43.

Repro Zend / VM / JIT AOT (2026-08-02)
LimitIterator(ArrayIterator([1..5]), 1, 2)iterator_to_array 2,3 BUILD fail: missing __generator_resume metadata
AppendIterator of two ArrayIterators 1,2,3 same
RegexIterator(..., '/^b/') bar,baz same

php-src reference

PHP implementation target

  • AOT/JIT iterator lowering must register resume metadata for SPL outer iterators (not only PHP generators) — lib/JIT/IteratorHelper.php / SPL iterator helpers in ext/spl/
  • PHP-in-PHP; no new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/li.php <<'"'"'PHP'"'"'
<?php
$it = new LimitIterator(new ArrayIterator([1,2,3,4,5]), 1, 2);
echo implode(\",\", iterator_to_array($it)), \"\n\";
PHP
php /tmp/li.php
php bin/vm.php /tmp/li.php
php bin/jit.php /tmp/li.php
php bin/compile.php -o /tmp/li /tmp/li.php
'

Done when

  • AOT build succeeds and prints 2,3 matching Zend/VM/JIT
  • AppendIterator / RegexIterator smoke also green (same metadata root)
  • Compliance or test/repro/ guard
  • php-src-strict; no php-compiler-strict shortcut

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-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