mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
The problem is that `php_request_shutdown` calls `php_deactivate_ticks` prior to running destructors and the shutdown functions and finalizing output handlers. So if a destructor or shutdown function re-registers a tick function, then the user tick functions handler will be added back to `PG(tick_functions)`. When the next request happens, the list `PG(tick_functions)` still contains an entry to call the user tick functions (added in the previous request during shutdown). This causes a NULL deref eventually because `run_user_tick_functions` assumes that if it is called then `BG(user_tick_functions)` must be non-NULL. Fix this by moving the tick handler deactivation. Closes GH-18047.
17 lines
309 B
PHP
17 lines
309 B
PHP
--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--
|
|
<?php
|
|
ob_start(function() {
|
|
declare(ticks=1);
|
|
register_tick_function(
|
|
function() { }
|
|
);
|
|
});
|
|
?>
|
|
--EXPECT--
|