Skip to content

Stdlib: ReflectionClass::isIterable() missing — Zend reports Traversable implementors (ext/reflection/php_reflection.c) #22117

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

ReflectionClass::isIterable() is not registered in this compiler build. Zend returns whether the reflected class is a concrete Traversable implementor (not whether the reflected name is the Traversable interface itself).

Repro Zend 8.2 VM (2026-07-22)
(new ReflectionClass(ArrayIterator::class))->isIterable() true method_exists false
(new ReflectionClass(stdClass::class))->isIterable() false method_exists false
(new ReflectionClass(Traversable::class))->isIterable() false method_exists false

php-src reference

PHP implementation target

  • lib/VM/BuiltinClasses.php — add isIterable method on ReflectionClass
  • ext/standard/VmReflection.php or lib/VM/Builtin/ReflectionClassIsIterable.php — reuse IterableCheck / implementsInterface(Traversable::class) on the resolved ClassEntry; compile-time guard only if needed for profile

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_reflection_class_isiterable.php'

Done when

  • ReflectionClass::isIterable() matches Zend for ArrayIterator, Generator, stdClass, Traversable, IteratorAggregate
  • Compliance .phpt under test/compliance/cases/stdlib/reflection_class_isiterable.phpt
  • VM/JIT/AOT agree when JIT dispatches reflection builtins
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    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 Jul 22, 2026
  2. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  3. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Merged via #22123

    Verification:

    • PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_reflection_class_isiterable.php → true/true/false/false/false
    • PHP_COMPILER_PROFILE=8.4 php vendor/bin/phpunit --configuration phpunit.xml.dist --filter reflection_class_isiterable → OK (2 tests, VM+JIT)
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 machinebugSomething 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