You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stdlib: constant() must resolve enum case constants (E::A, dynamic E::$name) (zend_constants.c) #5682
constant('Class::CONST') for user classes is tracked in #3484. Enum case constants are a separate lookup path in Zend (zend_enum_get_case_by_name, class constant table). This compiler fatals on VM when resolving enum cases:
constant('E::A') — uncaught VM fatal (not Error: Undefined constant)
Unclaiming: constant('E::A') enum case resolution already green on master (#5926). VM repro returns \E::A for literal + dynamic names. Recommend closing as duplicate of #3484 phase 2.
Fix:constant('C::X') when C::X = E::A canonicalizes enum case singletons via EnumCaseSupport::materializeConstantValue(); enum === compares FQCN + case name (not compile-time ClassEntry stub identity).
Category
stdlibProblem
constant('Class::CONST')for user classes is tracked in #3484. Enum case constants are a separate lookup path in Zend (zend_enum_get_case_by_name, class constant table). This compiler fatals on VM when resolving enum cases:constant('E::A')— uncaught VM fatal (notError: Undefined constant)constant('E::'.$c)— sameZend returns the enum case object (
\E::A).php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(constant)Zend/zend_constants.c— class/enum constant lookupZend/zend_enum.c— case by nameRepro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php' php repro.php\E::AtwiceExceptionSupport(enum constant unresolved)Scope (this repo)
ext/standard/constant_.php,ext/standard/VmConstants.php(or enum registry)lib/VM/EnumCaseSupport.php, enumClassEntrycase mapext/standard/JitConstant.php— phase 2 literal names onlytest/compliance/cases/stdlib/constant_enum_case.phptDone when
\E::Afor literal and dynamic namesconstant('E::Z')→Error: Undefined constant "E::Z"./script/ci-fast.sh --filter constant_enumgreenRelated