Fix GH-21699: callable resolution must fail if error handler threw during self/parent/static deprecations#21712
Open
macoaure wants to merge 2 commits intophp:PHP-8.4from
Open
Fix GH-21699: callable resolution must fail if error handler threw during self/parent/static deprecations#21712macoaure wants to merge 2 commits intophp:PHP-8.4from
macoaure wants to merge 2 commits intophp:PHP-8.4from
Conversation
Girgias
reviewed
Apr 10, 2026
Member
Girgias
left a comment
There was a problem hiding this comment.
As this is a fix please target the 8.4 branch.
To prevent requesting a review from everybody please first rebase onto 8.4, force push, and then change the target branch.
Comment on lines
+3773
to
+3776
| /* User error handlers may throw from deprecations above; do not report callable as valid. */ | ||
| if (UNEXPECTED(EG(exception))) { | ||
| return false; | ||
| } |
Member
There was a problem hiding this comment.
I think it makes more sense to have this be where the E_DEPRECATED are emitted. But then others may disagree so this is fine.
…after deprecations When resolving string callables using self::, parent::, or static::, zend_is_callable_check_class() emits E_DEPRECATED. If the user error handler throws, EG(exception) is set but the function could still return true, leading to trampoline allocation and a failed assertion in shutdown_executor(). Return false from zend_is_callable_check_class() when EG(exception) is set after handling. Add regression tests for self::, parent::, and static:: forms.
… handle TypeError in stack trace
4b775dd to
94efc8f
Compare
Author
Ok, sorry about that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request addresses a bug (GH-21699) where an assertion failure could occur in
shutdown_executorif an error handler throws an exception during the resolution ofself::,parent::, orstatic::callables. The fix ensures that if an exception is thrown by a user-defined error handler during callable resolution, the callable is not incorrectly reported as valid. The PR also adds comprehensive tests to cover these scenarios.Bug fix for callable resolution:
zend_is_callable_check_classinZend/zend_API.cto check for exceptions after error handlers run, preventing invalid callables from being reported as valid if an exception was thrown.Tests for error handler behavior:
Zend/tests/gh_21699.phptto testself::callable resolution when the error handler throws.Zend/tests/gh_21699_parent.phptto testparent::callable resolution with throwing error handler.Zend/tests/gh_21699_static.phptto teststatic::callable resolution with throwing error handler.Documentation:
NEWSto document the bug fix for assertion failures inshutdown_executorduring callable resolution with throwing error handlers.