Skip to content

Fix GH-22112: assertion when error handler throws during NaN coercion#22114

Open
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-22112-nan-coercion-eg-exception
Open

Fix GH-22112: assertion when error handler throws during NaN coercion#22114
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-22112-nan-coercion-eg-exception

Conversation

@iliaal
Copy link
Copy Markdown
Contributor

@iliaal iliaal commented May 21, 2026

Recv-arg verification for a userland function asserts !EG(exception) after a successful weak coercion. zend_parse_arg_bool_weak and zend_parse_arg_str_weak returned success without checking whether the NaN-coerced-to-bool/string warning had triggered a throw from the user error handler. Mirror the post-warning check in zend_parse_arg_long_weak.

Fixes #22112

zend_parse_arg_bool_weak and zend_parse_arg_str_weak could return success
with EG(exception) already set, because zend_is_true and convert_to_string
emit the NaN coercion warning without checking whether the user error
handler threw. Recv-arg verification for a userland function then took
the no-check ZEND_VM_NEXT_OPCODE branch, aborting on
ZEND_ASSERT(!EG(exception)). Mirror the existing check in
zend_parse_arg_long_weak and propagate failure when the warning leaves
an exception pending.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion failure at Zend/zend_vm_execute.h zend_verify_recv_arg_type_helper_SPEC

1 participant