Skip to content

Fix GH-24491: Static method stream error handler replaces pending exception - #24520

Merged
Girgias merged 2 commits into
php:masterfrom
lazerg:fix/gh-24491-stream-error-handler
Oct 23, 2026
Merged

Girgias merged 2 commits into
php:masterfrom
lazerg:fix/gh-24491-stream-error-handler

Conversation

@lazerg

@lazerg lazerg commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Since 2f7b01b, zend_is_callable() fills in an error string even when it fails because an exception is already pending, so php_stream_call_error_handler() threw a TypeError over the StreamException (or whatever the user error handler threw) for any Class::method handler. It now only throws when nothing is pending, the same way curl already does.

The same commit made zend_parse_arg() leak that error string when it bails out on a pending exception, so it's freed there now too.

Fixes GH-24491

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit but LGTM. Thanks for the fix. :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to the zpp subfolder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it to Zend/tests/zpp, thanks.

@Girgias
Girgias merged commit 551967d into php:master Oct 23, 2026
18 checks passed
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.

Stream error_handler given as 'Class::method' turns the real exception into a TypeError

2 participants