Skip to content

Regression: AOT CallbackFilterIterator yields empty — VM/JIT match Zend (ext/spl/spl_iterators.c) #27259

Description

@PurHur

Category

Regression · php-src-strict · AOT / SPL iterators

Problem

CallbackFilterIterator over an ArrayIterator with an evenness predicate returns 2,4 on Zend/VM/JIT. AOT builds but prints an empty string (no elements). Prior CallbackFilter work (#6692, #19771) closed VM/JIT/nested-new paths; AOT iteration still diverges on master (b3f4d02a5, 2026-08-03).

Repro Zend 8.2 VM / JIT AOT (2026-08-03)
CallbackFilterIterator(ArrayIterator([1,2,3,4]), fn($v)=>$v%2===0) via iterator_to_array 2,4 2,4 (empty)

php-src reference

PHP implementation target

  • ext/spl/ CallbackFilterIterator accept/next lowering for AOT — ensure user callable is invoked during AOT foreach/iterator_to_array; PHP-in-PHP only

Repro

./script/docker-exec.sh -- bash -lc 'cat >/tmp/cfi.php <<'"'"'P'"'"'
<?php
$a = new ArrayIterator([1, 2, 3, 4]);
$f = new CallbackFilterIterator($a, fn($v) => $v % 2 === 0);
echo implode(",", iterator_to_array($f)), "\n";
P
php /tmp/cfi.php
php bin/vm.php /tmp/cfi.php
php bin/jit.php /tmp/cfi.php 2>/dev/null
./phpc build -o /tmp/cfi.bin /tmp/cfi.php && /tmp/cfi.bin'

Done when

  • AOT stdout matches Zend/VM/JIT (2,4)
  • Compliance/AOT fixture covering CallbackFilterIterator + arrow function accept
  • php-src-strict; no php-compiler-strict shortcut

Activity

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: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