Skip to content

Commit 95c97c8

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-16181: phpdbg: exit in exception handler reports fatal error
2 parents bd724bd + f14e5cf commit 95c97c8

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ PHP NEWS
3838

3939
- PHPDBG:
4040
. Fixed bug GH-15901 (phpdbg: Assertion failure on i funcs). (cmb)
41+
. Fixed bug GH-16181 (phpdbg: exit in exception handler reports fatal error).
42+
(cmb)
4143

4244
- SimpleXML:
4345
. Fixed bug GH-15837 (Segmentation fault in ext/simplexml/simplexml.c).

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ PHPDBG_COMMAND(run) /* {{{ */
906906
}
907907
} zend_end_try();
908908

909-
if (EG(exception)) {
909+
if (EG(exception) && !zend_is_unwind_exit(EG(exception))) {
910910
phpdbg_handle_exception();
911911
}
912912
}

sapi/phpdbg/tests/gh16181.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
GH-16181 (phpdbg: exit in exception handler reports fatal error)
3+
--PHPDBG--
4+
r
5+
c
6+
q
7+
--FILE--
8+
<?php
9+
set_exception_handler(function() {
10+
echo "exception caught\n";
11+
die;
12+
});
13+
14+
echo "throwing exception\n";
15+
throw new \Exception("oh noes");
16+
?>
17+
--EXPECTF--
18+
[Successful compilation of %s]
19+
prompt> throwing exception
20+
[Uncaught Exception in %s on line %d: oh noes]
21+
>00008: throw new \Exception("oh noes");
22+
00009: ?>
23+
00010:
24+
prompt> exception caught
25+
[Script ended normally]
26+
prompt>

0 commit comments

Comments
 (0)