diff --git a/UPGRADING b/UPGRADING index 5d372c72e2139..11cca55bd1735 100644 --- a/UPGRADING +++ b/UPGRADING @@ -38,6 +38,9 @@ PHP 8.5 UPGRADE NOTES resources that were indirectly collected through cycles. . It is now allowed to substitute static with self or the concrete class name in final subclasses. + . The tick handlers are now deactivated after all shutdown functions, destructors + have run and the output handlers have been cleaned up. + This is a consequence of fixing GH-18033. - Intl: . The extension now requires at least ICU 57.1. diff --git a/Zend/tests/declare/gh18033_1.phpt b/Zend/tests/declare/gh18033_1.phpt new file mode 100644 index 0000000000000..ccce9360b4651 --- /dev/null +++ b/Zend/tests/declare/gh18033_1.phpt @@ -0,0 +1,24 @@ +--TEST-- +GH-18033 (NULL-ptr dereference when using register_tick_function in destructor) +--DESCRIPTION-- +Needs --repeat 2 or something similar to reproduce +--CREDITS-- +clesmian +--FILE-- + +--EXPECT-- +Done +In destructor diff --git a/Zend/tests/declare/gh18033_2.phpt b/Zend/tests/declare/gh18033_2.phpt new file mode 100644 index 0000000000000..8fdcff1b51e6c --- /dev/null +++ b/Zend/tests/declare/gh18033_2.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-18033 (NULL-ptr dereference when using register_tick_function in ob_start) +--DESCRIPTION-- +Needs --repeat 2 or something similar to reproduce +--CREDITS-- +clesmian +--FILE-- + +--EXPECT-- diff --git a/main/main.c b/main/main.c index 4075be8b377e3..415cb02185e94 100644 --- a/main/main.c +++ b/main/main.c @@ -1904,8 +1904,6 @@ void php_request_shutdown(void *dummy) */ EG(current_execute_data) = NULL; - php_deactivate_ticks(); - /* 0. Call any open observer end handlers that are still open after a zend_bailout */ if (ZEND_OBSERVER_ENABLED) { zend_observer_fcall_end_all(); @@ -1926,6 +1924,8 @@ void php_request_shutdown(void *dummy) php_output_end_all(); } zend_end_try(); + php_deactivate_ticks(); + /* 4. Reset max_execution_time (no longer executing php code after response sent) */ zend_try { zend_unset_timeout();