Category
language · php-src-strict · regression
Problem
#5798 was closed via PR #5802 (Variable::identicalTo / equals enum-vs-scalar guards), but the maintainer repro and compliance case enum_compare_backing_scalar.phpt still fail on VM (2026-06-04): E::A === 1, E::A == 1, and string-backed S::B === 'x' all return true.
Likely causes to investigate:
E::A not materialized as TYPE_ENUM_CASE at runtime (php-cfg isEnumCase / script/apply-patches.sh — enum case parsed as plain const).
- Compare path bypasses
Variable::identicalTo (constant-folded backing literal in compileClassConstFetch).
php-src reference
Repro
test/repro/maintainer_enum_compare_regression_5798.php (also test/compliance/cases/language/enum_compare_backing_scalar.phpt):
docker info >/dev/null
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_enum_compare_regression_5798.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_enum_compare_regression_5798.php'
Implementation (PHP-in-PHP)
- Ensure enum
case constants load as enum case objects (lib/Compiler.php compileTimeEnumCaseVar, lib/VM.php TYPE_DECLARE_CLASS_CONST, copyClassConstOrStaticPropertyByName).
- Keep compare guards in
lib/VM/Variable.php; add compliance green on VM before closing.
- JIT/AOT: same semantics in lowered compares when required by compliance.
Verification
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_enum_compare_regression_5798.php'
./script/ci-local.sh --filter 'enum_compare_backing_scalar'
Category
language· php-src-strict · regressionProblem
#5798 was closed via PR #5802 (
Variable::identicalTo/equalsenum-vs-scalar guards), but the maintainer repro and compliance caseenum_compare_backing_scalar.phptstill fail on VM (2026-06-04):E::A === 1,E::A == 1, and string-backedS::B === 'x'all return true.Likely causes to investigate:
E::Anot materialized asTYPE_ENUM_CASEat runtime (php-cfgisEnumCase/script/apply-patches.sh— enumcaseparsed as plain const).Variable::identicalTo(constant-folded backing literal incompileClassConstFetch).php-src reference
Zend/zend_operators.c—compare_function/ identityZend/zend_enum.cRepro
test/repro/maintainer_enum_compare_regression_5798.php(alsotest/compliance/cases/language/enum_compare_backing_scalar.phpt):Implementation (PHP-in-PHP)
caseconstants load as enum case objects (lib/Compiler.phpcompileTimeEnumCaseVar,lib/VM.phpTYPE_DECLARE_CLASS_CONST,copyClassConstOrStaticPropertyByName).lib/VM/Variable.php; add compliance green on VM before closing.Verification