Skip to content

Fix GH-16181: phpdbg: exit in exception handler reports fatal error #16182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sapi/phpdbg/phpdbg_prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ PHPDBG_COMMAND(run) /* {{{ */
}
} zend_end_try();

if (EG(exception)) {
if (EG(exception) && !zend_is_unwind_exit(EG(exception))) {
phpdbg_handle_exception();
}
}
Expand Down
26 changes: 26 additions & 0 deletions sapi/phpdbg/tests/gh16181.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
GH-16181 (phpdbg: exit in exception handler reports fatal error)
--PHPDBG--
r
c
q
--FILE--
<?php
set_exception_handler(function() {
echo "exception caught\n";
die;
});

echo "throwing exception\n";
throw new \Exception("oh noes");
?>
--EXPECTF--
[Successful compilation of %s]
prompt> throwing exception
[Uncaught Exception in %s on line %d: oh noes]
>00008: throw new \Exception("oh noes");
00009: ?>
00010:
prompt> exception caught
[Script ended normally]
prompt>
Loading