Runtime: set_exception_handler() / restore_exception_handler() VM stack (#3146) - #3887
Merged
Merged
Conversation
5 tasks
…ck (#3146) Wire uncaught-exception dispatch through a handler stack matching Zend zend_exceptions.c: closures and string callbacks, nested restore, and false return fallthrough before default fatal handling. Co-authored-by: Cursor <cursoragent@cursor.com>
Walk the handler stack by index during uncaught dispatch so handlers that return false remain registered (Zend zend_exceptions.c parity). Co-authored-by: Cursor <cursoragent@cursor.com>
Guards set_exception_handler('func_name') dispatch alongside closure handlers.
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur
force-pushed
the
agent/issue-3146-exception-handler
branch
from
May 31, 2026 09:10
274c097 to
4a56ac8
Compare
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.
Summary
set_exception_handler()andrestore_exception_handler()with a VM handler stack (ExceptionHandlerStack) wired into uncaught-exception dispatch inlib/VM.php.falsefalls through to the previous handler (Zendzend_exceptions.cparity)..phptcoverage; JIT umbrella skips these VM-only builtins until LLVM lowering exists.php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(set_exception_handler),restore_exception_handlerZend/zend_exceptions.c— uncaught handler chainVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter exception_handler'Closes #3146
Made with Cursor