Skip to content

Stdlib: ReflectionClass::getInterfaces() missing — getInterfaceNames OK (ext/reflection/php_reflection.c) #22170

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Zend's ReflectionClass::getInterfaces() returns a name => ReflectionClass map of implemented interfaces (including inherited). php-compiler exposes getInterfaceNames() / implementsInterface() but method_exists($r, 'getInterfaces') is false and calling it fatals.

Repro Zend 8.2+ (2026-07-22) VM (2026-07-22)
getInterfaceNames() on class C implements J {} (J extends I) ['J','I'] ['J','I']
getInterfaces() ['J'=>ReflectionClass, 'I'=>ReflectionClass] missing → Error: Call to undefined method
(string)$r / __toString non-empty reflection dump Error: Object of class ReflectionClass could not be converted to string

php-src reference

PHP implementation target

  • ext/standard/VmReflection.php — implement getInterfaces() by resolving getInterfaceNames() into ReflectionClass objects (same map shape as Zend); optional __toString can be a follow-up if not bundled

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r "
interface I {}
interface J extends I {}
class C implements J {}
\$r = new ReflectionClass(C::class);
var_export(method_exists(\$r, \"getInterfaces\"));
echo PHP_EOL;
var_export(\$r->getInterfaces());
"'

Compare with host php on the same snippet.

Done when

  • ReflectionClass::getInterfaces() returns name => ReflectionClass including parent interfaces (Zend order/keys)
  • Compliance .phpt under test/compliance/cases/ covering implements + interface inheritance
  • 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 Advanced — batch (issues #22144, #22170, #22171, #22166, #22167, #22169, #22173; sequential PRs)

    Queued after #22144.

  3. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — starting #22170 (after merged #22144 / PR #22186)

  4. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Merged #22189

    ReflectionClass::getInterfaces() returns Zend-ordered name => ReflectionClass (incl. parent interfaces). Verified issue repro + compliance + north-star5-verify-fast.

    Next: #22171 returnsReference().

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