Skip to content

Regression: class_has_method/property/constant() phantoms on PROFILE≥8.4 — Zend ReflectionClass::has* only (re-#9989, ext/standard) #28413

Closed

Description

@PurHur

Category

bug · php-src-strict · phantom builtins · pillar 4

Problem

PROFILE≥8.4 advertises free functions class_has_method(), class_has_property(), class_has_constant() (and lazy-object variants class_has_lazy_object_initializer / class_has_lazy_object_uninitializer). php-src never registered these — the real APIs are ReflectionClass::hasMethod / hasProperty / hasConstant. Prior #9989/#15025 treated them as missing 8.4 surface; that was incorrect relative to php-src stubs.

Repro Zend / php-src 8.4 VM PROFILE=8.4 (2026-08-07 @ dc14701)
function_exists('class_has_method') false true
function_exists('class_has_property') false true
function_exists('class_has_constant') false true
(new ReflectionClass(DateTime::class))->hasConstant('ATOM') true true

php-src reference

PHP implementation target

  • lib/CompilerVersion.php — supportsClassHasFunctions / advertisement → false on php-src-strict
  • ext/standard/Module.php + class_has_*.php — stop registering phantoms; leave ReflectionClass methods alone; PHP-in-PHP only

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php /dev/stdin' <<'PHP'
<?php
foreach (['class_has_method','class_has_property','class_has_constant'] as $f) {
  echo $f, '=', function_exists($f) ? '1' : '0', PHP_EOL; // expect 0
}
echo (new ReflectionClass(DateTime::class))->hasConstant('ATOM') ? "RC_ok\n" : "RC_bad\n";
PHP

Done when

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 A — starting this run

    Prior claim #28692 closed as not-a-defect (file/ext APIs are 8.5+; 8.4 phantom gate already correct). Taking this ReflectionClass vs phantom class_has_* free-function gap next.

  3. PurHur commented on Aug 7, 2026

    @PurHur
    OwnerAuthor

    Merged via #28764

    Verification

    • PROFILE=8.4: function_exists(class_has_*) → 0; ReflectionClass::hasConstant('ATOM') → ok
    • Unit Issue28413ClassHasFunctionsPhantomTest + flipped advertisement/gate tests — OK
    • Compliance class_has_functions_phantom (+ _84) — OK
    • Inventory OK 7215/7215

    supportsClassHasFunctions() now always false (same pattern as #28616 isAnonymousClass).

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