Category
bug · php-src-strict · PHP 8.4 implicit-nullable deprecation
Problem
PHP 8.4 deprecates implicitly nullable typed parameters (function f(int $x = null) without ?int). CompilerVersion::supportsImplicitNullableParameterDeprecation() is already true under PHP_COMPILER_PROFILE=8.4, but file parseAndCompile emits no E_DEPRECATED — the callable still runs and prints NULL.
Closed as fixed in #26083 / #23720 / #22987 / #21390 / #29274 (wording). Tip e188cdc565 is silent again.
Repro (2026-08-13, tip e188cdc565) |
Zend 8.4 |
VM PHP_COMPILER_PROFILE=8.4 |
function f(int $x = null) { var_export($x); } f(); |
E_DEPRECATED: f(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type ?int should be used instead then NULL |
NULL only (no Deprecated) ❌ |
Host Zend 8.2 is silent (correct). PROFILE=8.2 / unset 8.4.0-dev should stay silent; the missing diagnostic is the 8.4 compile-time deprecation.
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php -d error_reporting=E_ALL bin/vm.php -r "function f(int \$x = null) { var_export(\$x); echo PHP_EOL; } f();"'
Done when
Category
bug· php-src-strict · PHP 8.4 implicit-nullable deprecationProblem
PHP 8.4 deprecates implicitly nullable typed parameters (
function f(int $x = null)without?int).CompilerVersion::supportsImplicitNullableParameterDeprecation()is already true underPHP_COMPILER_PROFILE=8.4, but fileparseAndCompileemits noE_DEPRECATED— the callable still runs and printsNULL.Closed as fixed in #26083 / #23720 / #22987 / #21390 / #29274 (wording). Tip
e188cdc565is silent again.e188cdc565)PHP_COMPILER_PROFILE=8.4function f(int $x = null) { var_export($x); } f();E_DEPRECATED: f(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type ?int should be used insteadthenNULLNULLonly (no Deprecated) ❌Host Zend 8.2 is silent (correct).
PROFILE=8.2/ unset 8.4.0-dev should stay silent; the missing diagnostic is the 8.4 compile-time deprecation.php-src reference
Zend/zend_compile.c—zend_compile_params/ RFC deprecate-implicitly-nullable-typesUPGRADING— PHP 8.4 implicit nullablePHP implementation target
lib/Compiler.phpparam compile (or existing implicit-nullable rewriter) — emit Zend-shapedE_DEPRECATEDwhensupportsImplicitNullableParameterDeprecation()f(): Implicitly marking…(Language: implicit nullable E_DEPRECATED omits function name prefix — Zend "f(): Implicitly marking…" (zend_compile.c) #29274)Repro
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php -d error_reporting=E_ALL bin/vm.php -r "function f(int \$x = null) { var_export(\$x); echo PHP_EOL; } f();"'Done when
E_DEPRECATEDwording matches Zend (f(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type ?int should be used instead)PROFILE=8.2/ unset reference: still silent like Zend 8.2?int $x = nulldoes not deprecate.phpt+ php-src-strict; no php-compiler-strict shortcut