Skip to content

Fix hash AOT PROFILE=8.4 compile SIGSEGV and pack(null) compile crash - #36123

Merged
PurHur merged 1 commit into
masterfrom
fix/hash-aot-profile-pack-null
Sep 1, 2026
Merged

PurHur merged 1 commit into
masterfrom
fix/hash-aot-profile-pack-null

Conversation

@PurHur

@PurHur PurHur commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

php-src refs: ext/hash/hash.c (Z_PARAM_STR), ext/standard/pack.c (null coerce).

Test plan

$ ./script/aot-smoke.sh
aot-smoke: 8 passed, 0 failed

$ ./script/phpunit.sh --filter 'hash_hmac_update_null_key_forward84|issue_21209_hash_pack_null_forward84|hash_null_algo_forward84'
OK (3 tests, 15 assertions)

$ ./script/docker-exec.sh -- bash -lc 'work=$(mktemp -d); export PHP_COMPILER_PROFILE=8.4;
  cat > "$work/t.php" <<PHP
<?php echo hash("md5","x"), "\n";
PHP
  php bin/compile.php -o "$work/t.bin" "$work/t.php" && "$work/t.bin"'
9dd4e461268c8034f5c8564e155c67a6

Closes #21557, #21209, #21490.

Made with Cursor

…compile crash.

Explicit PHP_COMPILER_PROFILE during user-script AOT compile breaks StringHashCrypto
helper ABI; exclude it from compile env (runtime PROFILE still applies). Coerce
pack() null value operands to empty string per Zend (#21209). Align hash null-algo
fixture with Zend 8.4 ValueError.

Closes #21557, #21209, #21490.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit decb6e3 into master Sep 1, 2026
@PurHur
PurHur deleted the fix/hash-aot-profile-pack-null branch September 1, 2026 01:55
PurHur added a commit that referenced this pull request Sep 1, 2026
…e clear (#34379). (#36140)

#36123 cleared PHP_COMPILER_PROFILE during user-script AOT compile for hash helper ABI,
but supportsMbTrimFunctions() only read getenv('PHP_COMPILER_PROFILE') and skipped
registration. Route forward-profile gates through languageProfileVersion() so
PHP_COMPILER_AOT_COMPILE_PROFILE (already snapshotted in compile.php) applies.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: hash_hmac(null $key)/hash_update(null) TypeError under PROFILE=8.4 — Zend DEP+coerce (re-#20175/#20195, ext/hash/hash.c)

1 participant