Category
stdlib · php-src-strict · PHP 8.4 null→TypeError (Z_PARAM_STR)
Problem
php-src bindec/hexdec/octdec parse with Z_PARAM_STR. On PHP 8.4, null must raise TypeError, not coerce to \"\" / return 0. Under PHP_COMPILER_PROFILE=8.4 this compiler still coerces (via VmString::stringBuiltinArgForFrame → coerceStringBuiltinArg, where requiresForwardProfileStrictStringNull() is false). Sibling converters decbin/dechex/decoct already TypeError on null.
| Repro |
php-src 8.4 (Z_PARAM_STR) |
VM (2026-07-18) |
bindec(null) |
TypeError |
0 (coerce) |
hexdec(null) |
TypeError |
0 (coerce) |
octdec(null) |
TypeError |
0 (coerce) |
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_NNNNN_bindec_hexdec_octdec_null.php'
Minimal script:
<?php
foreach ([\"bindec\",\"hexdec\",\"octdec\"] as $f) {
try { var_export($f(null)); echo \" $f=COERCE\n\"; }
catch (TypeError $e) { echo \"$f=TYPEERROR\n\"; }
}
Done when
Refs: pillar 4 on #10533; related trim/strlen batch #20635 (different builtins).
Category
stdlib· php-src-strict · PHP 8.4 null→TypeError (Z_PARAM_STR)Problem
php-src
bindec/hexdec/octdecparse withZ_PARAM_STR. On PHP 8.4,nullmust raiseTypeError, not coerce to\"\"/ return0. UnderPHP_COMPILER_PROFILE=8.4this compiler still coerces (viaVmString::stringBuiltinArgForFrame→coerceStringBuiltinArg, whererequiresForwardProfileStrictStringNull()is false). Sibling convertersdecbin/dechex/decoctalready TypeError on null.bindec(null)0(coerce)hexdec(null)0(coerce)octdec(null)0(coerce)php-src reference
ext/standard/math.c—PHP_FUNCTION(bindec|hexdec|octdec)+Z_PARAM_STRext/standard/basic_functions.stub.php—function bindec(string $binary_string)PHP implementation target
ext/standard/bindec.php,hexdec.php,octdec.php— switch VM/JIT args toVmString::zparamStrBuiltinArgForFrame/coerceZparamStrBuiltinArg(same path asbin2hexRegression: bin2hex(null) still coerces under PROFILE=8.4 (re-#20007, ext/standard/string.c) #20154)runtime/Repro
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_NNNNN_bindec_hexdec_octdec_null.php'Minimal script:
Done when
PHP_COMPILER_PROFILE=8.4:bindec/hexdec/octdec(null) →TypeErroron VM + JIT/AOT.phptundertest/compliance/cases/(or extend existing math null suite)Refs: pillar 4 on #10533; related trim/strlen batch #20635 (different builtins).