Skip to content

Regression: isAnonymousClass() phantom on PROFILE≥8.4 — Zend ReflectionClass::isAnonymous only (ext/reflection/php_reflection.stub.php) #28616

Closed

Description

@PurHur

Category

bug · php-src-strict · phantom API · PHP_COMPILER_PROFILE≥8.4 · pillar 4

Problem

function_exists('isAnonymousClass') is true under PHP_COMPILER_PROFILE=8.4/8.5, but php-src never ships a free function — only ReflectionClass::isAnonymous(). lib/CompilerVersion.php already documents this as kept “until a dedicated phantom issue”. Re-verified 2026-08-07 on master @ 823e740094.

Repro Zend 8.2–8.5 VM PROFILE=8.4 (2026-08-07 @ 823e740)
function_exists('isAnonymousClass') false true
isAnonymousClass(new class {}) n/a (undefined) true
(new ReflectionClass(new class {}))->isAnonymous() true true

Sibling phantoms already queued: class_has_* (#28413), get_last_response_headers (#28412), header_list (#28404), MemoryUsage (#28411), ParseUrl (#28536), fadd/… (#28565).

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php -r '\''
var_export(function_exists("isAnonymousClass")); echo "\n";
'\'''

Expect false (Zend). Today prints true.

Done when

  • function_exists('isAnonymousClass') === false on PROFILE 8.2–8.5
  • ReflectionClass::isAnonymous() still works for anonymous classes
  • Compliance / capability matrix no longer advertise the free function
  • 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 Aug 7, 2026
  2. PurHur commented on Aug 7, 2026

    @PurHur
    OwnerAuthor

    claim: Worker lane C — starting this run

    Gate snapshot (before implement):

  3. PurHur commented on Aug 7, 2026

    @PurHur
    OwnerAuthor

    Merged #28736

    Verification:

    • VM PROFILE=8.2/8.4/8.5: test/repro/issue_28616_isanonymousclass_phantom.php → ok (free function withheld; ReflectionClass::isAnonymous works)
    • JIT PROFILE=8.4/8.5: function_exists('isAnonymousClass') → false
    • PHPUnit: IsAnonymousClassPhantomVMTest / IsAnonymousClassPhantomJITTest + unit gates OK
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