Skip to content

Regression: password_hash()/gzencode()/implode(null) TypeError under PROFILE=8.4 — Zend DEP+coerce (ext/standard/password.c, zlib, array.c) #21210

Description

@PurHur

Category

Regression · php-src-strict · over-strict null reject (Pillar 4)

Problem

Under PHP_COMPILER_PROFILE=8.4, password_hash / gzencode / implode throw TypeError when a string operand is null. Zend 8.4.23 emits E_DEPRECATED and coerces (password_hash hashes '', gzencode encodes empty, implode(null, …) uses '' separator → 'ab').

Probed 2026-07-20 vs php:8.4-cli (8.4.23) and php bin/vm.php.

Repro Zend 8.4.23 VM PROFILE=8.4
password_hash(null, PASSWORD_DEFAULT) E_DEPRECATED + $2y$… hash of '' TypeError ❌
gzencode(null) E_DEPRECATED + 20-byte gzip of empty TypeError ❌
implode(null, ['a','b']) E_DEPRECATED + 'ab' TypeError ❌

php-src reference

PHP implementation target

  • Soften null reject under PROFILE=8.4 via shared string coerce+deprecation helpers in the PHP builtins + JIT lowering. PHP-in-PHP; no new C. VM/JIT/AOT agree. Distinct from open #4162 (password_verify scalar coerce).

Repro

./script/docker-exec.sh -- bash -lc 'export PHP_COMPILER_PROFILE=8.4
php bin/vm.php -r "
set_error_handler(function (\$n, \$m) { echo \"DEP\\n\"; return true; });
\$cases = [
  [\"password_hash\", [null, PASSWORD_DEFAULT]],
  [\"gzencode\", [null]],
  [\"implode\", [null, [\"a\", \"b\"]]],
];
foreach (\$cases as [\$f, \$a]) {
  try { \$r = \$f(...\$a); echo \$f, \" OK\\n\"; }
  catch (Throwable \$e) { echo \$f, \" \", get_class(\$e), PHP_EOL; }
}
"
# expect DEP + OK, not TypeError
'

Done when

  • Listed builtins match Zend 8.4 DEP + coerce results under PROFILE=8.4 on VM/JIT/AOT
  • PROFILE=8.2 unchanged vs Zend 8.2
  • Compliance/repro guard; php-src-strict; no new C

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions