Fix incorrect handling of unwind and graceful exit exceptions

These exceptions should not invoke the user error handler, and not cause bailing
of the request.

Fixes GH-11601
Closes GH-11608
This commit is contained in:
Ilija Tovilo 2023-07-06 22:45:29 +02:00
parent cf587c1a1b
commit 11aee73572
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
3 changed files with 10 additions and 6 deletions

View file

@ -199,8 +199,14 @@ ZEND_API ZEND_COLD void zend_throw_exception_internal(zend_object *exception) /*
return;
}
if (EG(exception)) {
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF
&& !zend_is_unwind_exit(EG(exception))
&& !zend_is_graceful_exit(EG(exception))) {
zend_user_exception_handler();
if (EG(exception)) {
zend_exception_error(EG(exception), E_ERROR);
}
return;
} else {
zend_exception_error(EG(exception), E_ERROR);
}