mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Fix GH-16181: phpdbg: exit in exception handler reports fatal error
When running PHP code, we must not handle `UnwindExit` exceptions, but rather have to ignore them. Closes GH-16182.
This commit is contained in:
parent
2bcf3f9e23
commit
f14e5cfaaa
2
NEWS
2
NEWS
@ -39,6 +39,8 @@ PHP NEWS
|
||||
|
||||
- PHPDBG:
|
||||
. Fixed bug GH-15901 (phpdbg: Assertion failure on i funcs). (cmb)
|
||||
. Fixed bug GH-16181 (phpdbg: exit in exception handler reports fatal error).
|
||||
(cmb)
|
||||
|
||||
- SimpleXML:
|
||||
. Fixed bug GH-15837 (Segmentation fault in ext/simplexml/simplexml.c).
|
||||
|
@ -907,7 +907,7 @@ free_cmd:
|
||||
}
|
||||
} zend_end_try();
|
||||
|
||||
if (EG(exception)) {
|
||||
if (EG(exception) && !zend_is_unwind_exit(EG(exception))) {
|
||||
phpdbg_handle_exception();
|
||||
}
|
||||
}
|
||||
|
26
sapi/phpdbg/tests/gh16181.phpt
Normal file
26
sapi/phpdbg/tests/gh16181.phpt
Normal file
@ -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…
Reference in New Issue
Block a user