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
Closure named argument unpacking between temporary closures can cause a crash #19653
moreover, if I comment out the first call to usage1 with empty argument list, the second call succeeds
PHP Version
PHP 8.4.11 (cli) (built: Aug 3 2025 08:49:56) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.11, Copyright (c) Zend Technologies
with Zend OPcache v8.4.11, Copyright (c), by Zend Technologies
Can repro, fails with opline->opcode == 63 in debug mode. Will make a look. Thanks for reporting.
EDIT: also breaks on PHP 8.3.
EDIT 2: it seems variadics are broken wrt the loop in zend_handle_undef_args() EDIT: (no actually that seems fine)
EDIT 3: and cache slot priming in ZEND_SEND_VAL_EX assuming the argument number stays the same ...
EDIT 2: it seems variadics are broken wrt the loop in zend_handle_undef_args()
yeah, I've got to heap corruption, but it all started with ridiculous ArgumentCountError: {closure:file.php:164}(): Argument #1 not passed in a larger codebase
The root cause is that zend_handle_named_arg stores the fbc and assumes its address is unique. However, that's not the case: for closures it's possible a memory address is reused leading to unexpected equality between functions that are not actually equal.
changed the title [-]`zend_mm_heap corrupted` in closure named arguments unpacking?[/-][+]Closure named argument unpacking between temporary closures can cause a crash[/+]on Aug 31, 2025
Activity
ndossche commentedon Aug 31, 2025
Can repro, fails with
opline->opcode == 63in debug mode. Will make a look. Thanks for reporting.EDIT: also breaks on PHP 8.3.
EDIT 2: it seems variadics are broken wrt the loop in zend_handle_undef_args() EDIT: (no actually that seems fine)
EDIT 3: and cache slot priming in ZEND_SEND_VAL_EX assuming the argument number stays the same ...
ivan-u7n commentedon Aug 31, 2025
@nielsdos
yeah, I've got to heap corruption, but it all started with ridiculous
ArgumentCountError: {closure:file.php:164}(): Argument #1 not passedin a larger codebasendossche commentedon Aug 31, 2025
The root cause is that
zend_handle_named_argstores thefbcand assumes its address is unique. However, that's not the case: for closures it's possible a memory address is reused leading to unexpected equality between functions that are not actually equal.[-]`zend_mm_heap corrupted` in closure named arguments unpacking?[/-][+]Closure named argument unpacking between temporary closures can cause a crash[/+]Fix phpGH-19653: Closure named argument unpacking between temporary c…
Merge branch 'PHP-8.3' into PHP-8.4
Merge branch 'PHP-8.4'
Fix GH-19653: Closure named argument unpacking between temporary clos…