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
Regression: sprintf()/vsprintf(null) still coerce under PROFILE=8.4 (ext/standard/formatted_print.c) #20167
Under PHP_COMPILER_PROFILE=8.4, sprintf('%s', null) and vsprintf('%s', [null]) still coerce null to '' and succeed. php-src 8.4 rejects null for typed string zpp value arguments with TypeError.
Repro (PROFILE=8.4)
php-src 8.4
VM (2026-07-17)
sprintf('%s', null)
TypeError
''
vsprintf('%s', [null])
TypeError
''
Open #8777 covers enum case operands for sprintf/printf/vsprintf — this issue is specifically null under the 8.4 forward profile.
PHP 8.4: null to non-nullable internal string args → TypeError
PHP implementation target
ext/standard/sprintf.php / vsprintf.php (or shared formatted-print helper in ext/standard/)
Shared null guard used by other 8.4 string builtins (VmString::coerceZparamStrBuiltinArg family) when formatting consumes a string slot — PHP-in-PHP only, no new C
php script/bootstrap-inventory.php --check — red: stale docs/bootstrap-inventory.md (ext/dom/VmDom.php method count 402→404; doc drift from recent DOM merges, not this issue)
./script/release-readiness.sh --json — running
Implementing sprintf/vsprintf null→TypeError under PROFILE=8.4 (php-src-strict).
Abandoning claim — php-src-strict mismatch on done-when
Repro under Zend PHP 8.2.31 and this compiler (PHP_COMPILER_PROFILE=8.4):
sprintf('%s', null) / vsprintf('%s', [null]) → coerce to '' (no TypeError)
Format-arg sprintf(null) → deprecate + coerce (Z_PARAM_STR), not value-arg TypeError
php-src / null_coercion_consistency RFC explicitly keeps sprintf('%s', NULL) coercing; value slots are not Z_PARAM_STR. Implementing TypeError here would diverge from Zend.
Leaving open for maintainer retarget (e.g. format-arg 8.4 TypeError if that is the intent) or close as invalid.
Closing as invalid per prior investigation: php-src 8.4 does not throw TypeError for sprintf('%s', null) or vsprintf('%s', [null]). The variadic ...$values parameter uses Z_PARAM_VARIADIC('+', ...) (mixed), not Z_PARAM_STR. The %s conversion calls zval_get_string() which coerces null to "" — no deprecation, no TypeError.
The null→TypeError deprecation path applies only to parameters declared with Z_PARAM_STR (typed string params), e.g. the format argument itself — which is already handled by VmString::stringBuiltinArgForFrame().
Current VM behavior (sprintf('%s', null) → '') matches Zend 8.2 and 8.4.
Activity
PurHur commentedon Jul 18, 2026
claim: PHP Compiler STD Lib — starting this run
Trust probe (this workspace):
docker infoOK; vendor presentphp script/bootstrap-inventory.php --check— red: staledocs/bootstrap-inventory.md(ext/dom/VmDom.php method count 402→404; doc drift from recent DOM merges, not this issue)./script/release-readiness.sh --json— runningImplementing sprintf/vsprintf null→TypeError under PROFILE=8.4 (php-src-strict).
PurHur commentedon Jul 18, 2026
Abandoning claim — php-src-strict mismatch on done-when
Repro under Zend PHP 8.2.31 and this compiler (
PHP_COMPILER_PROFILE=8.4):sprintf('%s', null)/vsprintf('%s', [null])→ coerce to''(no TypeError)sprintf(null)→ deprecate + coerce (Z_PARAM_STR), not value-arg TypeErrorphp-src / null_coercion_consistency RFC explicitly keeps
sprintf('%s', NULL)coercing; value slots are notZ_PARAM_STR. Implementing TypeError here would diverge from Zend.Leaving open for maintainer retarget (e.g. format-arg 8.4 TypeError if that is the intent) or close as invalid.
PurHur commentedon Jul 21, 2026
Closing as invalid per prior investigation: php-src 8.4 does not throw
TypeErrorforsprintf('%s', null)orvsprintf('%s', [null]). The variadic...$valuesparameter usesZ_PARAM_VARIADIC('+', ...)(mixed), notZ_PARAM_STR. The%sconversion callszval_get_string()which coerces null to""— no deprecation, no TypeError.The null→TypeError deprecation path applies only to parameters declared with
Z_PARAM_STR(typed string params), e.g. the format argument itself — which is already handled byVmString::stringBuiltinArgForFrame().Current VM behavior (
sprintf('%s', null)→'') matches Zend 8.2 and 8.4.