File tree Expand file tree Collapse file tree 3 files changed +32
-6
lines changed
Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -7,17 +7,19 @@ class test1 {
77 register_shutdown_function (array ($ this , 'shutdown ' ));
88 }
99 public function shutdown () {
10- exit (__METHOD__ );
10+ exit (static ::class . ' :: ' . __FUNCTION__ . "\n" );
1111 }
1212}
1313
1414class test2 extends test1 {
1515 public function __destruct () {
16- exit ( __METHOD__ );
16+ exit ( static ::class . ' :: ' . __FUNCTION__ . "\n" );
1717 }
1818}
1919new test1 ;
2020new test2 ;
2121?>
2222--EXPECT--
23- test1::shutdowntest2::__destruct
23+ test1::shutdown
24+ test2::shutdown
25+ test2::__destruct
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Gh-18619: exit() from error handler should not trigger bailout
3+ --FILE--
4+ <?php
5+
6+ function foo ($ e ) {
7+ exit ;
8+ }
9+
10+ set_exception_handler ('foo ' );
11+
12+ register_shutdown_function (function () {
13+ var_dump (set_exception_handler (null ));
14+ });
15+
16+ throw new Error ();
17+
18+ ?>
19+ --EXPECT--
20+ string(3) "foo"
Original file line number Diff line number Diff line change @@ -210,9 +210,13 @@ ZEND_API ZEND_COLD void zend_throw_exception_internal(zend_object *exception) /*
210210 return ;
211211 }
212212 if (EG (exception )) {
213- if (Z_TYPE (EG (user_exception_handler )) != IS_UNDEF
214- && !zend_is_unwind_exit (EG (exception ))
215- && !zend_is_graceful_exit (EG (exception ))) {
213+ if (zend_is_unwind_exit (EG (exception ))
214+ || zend_is_graceful_exit (EG (exception ))) {
215+ /* Stack is fully unwound, clear the unwind exit. */
216+ zend_exception_error (EG (exception ), E_ERROR );
217+ return ;
218+ }
219+ if (Z_TYPE (EG (user_exception_handler )) != IS_UNDEF ) {
216220 zend_user_exception_handler ();
217221 if (EG (exception )) {
218222 zend_exception_error (EG (exception ), E_ERROR );
You can’t perform that action at this time.
0 commit comments