8000 Clear recorded errors before executing shutdown functions · php/php-src@586daec · GitHub
[go: up one dir, main page]

Skip to content

Commit 586daec

Browse files
committed
Clear recorded errors before executing shutdown functions
Recorded errors may be attached to the wrong cached script when a fatal error occurs during recording. This happens because the fatal error will cause a bailout, which may prevent the recorded errors from being freed. If an other script is compiled after bailout, or if a class is linked after bailout, the recorded errors will be attached to it. This change fixes this by freeing recorded errors before executing shutdown functions. Fixes GH-8063
1 parent e4c7ffc commit 586daec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/standard/basic_functions.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,11 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_
17671767
PHPAPI void php_call_shutdown_functions(void) /* {{{ */
17681768
{
17691769
if (BG(user_shutdown_function_names)) {
1770+
if (EG(record_errors)) {
1771+
zend_free_recorded_errors();
1772+
EG(record_errors) = false;
1773+
}
1774+
17701775
zend_try {
17711776
zend_hash_apply(BG(user_shutdown_function_names), user_shutdown_function_call);
17721777
} zend_end_try();

0 commit comments

Comments
 (0)
0