Category
stdlib · php-src-strict · regression
Problem
Closed #5613 added TypeError for enum case operands to core math builtins. VM regressed: abs/ceil/floor/round/sqrt silently coerce backed enum cases to scalars instead of raising TypeError like Zend (Z_PARAM_NUMBER / Z_PARAM_DOUBLE in php-src).
Verified 2026-06-15 on master.
php-src reference
Repro
Existing maintainer script:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro-maintainer/parity_math_builtin_enum_type_error.php
php bin/vm.php test/repro-maintainer/parity_math_builtin_enum_type_error.php'
| Engine |
Expected per function |
| Zend PHP 8.3+ |
TypeError: {fn}(): Argument #1 ($num) must be of type int|float, Ei given |
| This compiler VM (today) |
prints {fn} uncaught (coercion, no TypeError) |
Minimal inline:
<?php
enum Ei: int { case N = 5; }
try { round(Ei::N); echo "uncaught\n"; } catch (TypeError $e) { echo $e->getMessage(), "\n"; }
Scope (this repo)
| Layer |
Path |
| VM |
ext/standard/VmMath.php — reject enum cases before numeric coercion |
| JIT/AOT |
lib/JIT/Builtin/*Math* / JitStringBuiltinArg guards mirroring VM |
| Tests |
test/compliance/cases/stdlib/math_enum_type_error.phpt (restore from #5613) |
Done when
Related
Category
stdlib· php-src-strict · regressionProblem
Closed #5613 added
TypeErrorfor enum case operands to core math builtins. VM regressed:abs/ceil/floor/round/sqrtsilently coerce backed enum cases to scalars instead of raisingTypeErrorlike Zend (Z_PARAM_NUMBER/Z_PARAM_DOUBLEin php-src).Verified 2026-06-15 on
master.php-src reference
ext/standard/math.c—ZEND_PARSE_PARAMETERStype checksZend/zend_enum.cRepro
Existing maintainer script:
TypeError: {fn}(): Argument #1 ($num) must be of type int|float, Ei given{fn} uncaught(coercion, no TypeError)Minimal inline:
Scope (this repo)
ext/standard/VmMath.php— reject enum cases before numeric coercionlib/JIT/Builtin/*Math*/JitStringBuiltinArgguards mirroring VMtest/compliance/cases/stdlib/math_enum_type_error.phpt(restore from #5613)Done when
TypeErrorfor all five functions on VM./script/ci-fast.sh --filter math_enum_type_errorgreenRelated