Skip to content

Regression: Closure::getCurrent() — method_exists true on Zend 8.2 reference profile (re-#13981, Zend/zend_closures.c) #14221

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Closure::getCurrent() is a PHP 8.4+ API. Implementation landed in #13981, but on the reference profile (host PHP 8.2) method_exists(Closure::class, 'getCurrent') must be false like Zend. VM reports true, a phantom method registration breaking capability probes and function_exists-style library gates.

Forward-line builds advertising PHP 8.4 may expose the method when CompilerVersion::supportsClosureGetCurrent() is true and host PHP version matches — not unconditionally on 8.2 reference.

php-src reference

PHP implementation target

  • lib/VM/BuiltinClasses.php / ClosureState registration gated by CompilerVersion::supportsClosureGetCurrent() + host reference parity — no new C in runtime/

Repro

test/repro/maintainer_gap_closure_get_current_phantom.php

./script/docker-exec.sh -- php test/repro/maintainer_gap_closure_get_current_phantom.php
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_closure_get_current_phantom.php
Probe (host PHP 8.2) Zend VM
method_exists(Closure::class, 'getCurrent') false true

Functional repro when enabled: test/repro/maintainer_gap_closure_get_current.php.

Done when (php-src-strict)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-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