diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 887064cf2e70b..448194f13d261 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -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(); } } diff --git a/sapi/phpdbg/tests/gh16181.phpt b/sapi/phpdbg/tests/gh16181.phpt new file mode 100644 index 0000000000000..478bbb98ca0d9 --- /dev/null +++ b/sapi/phpdbg/tests/gh16181.phpt @@ -0,0 +1,26 @@ +--TEST-- +GH-16181 (phpdbg: exit in exception handler reports fatal error) +--PHPDBG-- +r +c +q +--FILE-- + +--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>