Skip to content

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

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

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

Conversation

@iliaal
Copy link
Copy Markdown
Owner

@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 php#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
@iliaal
Copy link
Copy Markdown
Owner Author

iliaal commented May 21, 2026

Submitted upstream as php#22114. Closing this staging PR.

@iliaal iliaal closed this May 21, 2026
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.

Assertion failure at Zend/zend_vm_execute.h zend_verify_recv_arg_type_helper_SPEC

1 participant