From 1009208abfc432ff7de195aaf670d03752be08dd Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Fri, 21 Oct 2022 22:07:44 +0200 Subject: [PATCH] Remove unnecessary ast eval bailout We can just reset the filename_override to NULL in php_request_shutdown. --- Zend/zend_ast.c | 11 +---------- Zend/zend_execute_API.c | 2 -- main/main.c | 3 +++ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index acde144eb76f..63146fc5dd24 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -801,8 +801,6 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_ex(zval *result, zend_ast *as { zend_string *class_name = zend_ast_get_str(ast->child[0]); zend_string *const_name = zend_ast_get_str(ast->child[1]); - zval *zv; - bool bailout = 0; zend_string *previous_filename; zend_long previous_lineno; @@ -812,18 +810,11 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_ex(zval *result, zend_ast *as EG(filename_override) = scope->info.user.filename; EG(lineno_override) = zend_ast_get_lineno(ast); } - zend_try { - zv = zend_get_class_constant_ex(class_name, const_name, scope, ast->attr); - } zend_catch { - bailout = 1; - } zend_end_try(); + zval *zv = zend_get_class_constant_ex(class_name, const_name, scope, ast->attr); if (scope) { EG(filename_override) = previous_filename; EG(lineno_override) = previous_lineno; } - if (bailout) { - zend_bailout(); - } if (UNEXPECTED(zv == NULL)) { ZVAL_UNDEF(result); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 3e19c0cfa8ee..82c38366d89a 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -471,8 +471,6 @@ void shutdown_executor(void) /* {{{ */ if (EG(ht_iterators) != EG(ht_iterators_slots)) { efree(EG(ht_iterators)); } - - ZEND_ASSERT(EG(filename_override) == NULL); } #if ZEND_DEBUG diff --git a/main/main.c b/main/main.c index 4f7e3f2fbcfc..8be52d316a15 100644 --- a/main/main.c +++ b/main/main.c @@ -1588,6 +1588,9 @@ static void php_free_request_globals(void) efree(PG(php_sys_temp_dir)); PG(php_sys_temp_dir) = NULL; } + + EG(filename_override) = NULL; + EG(lineno_override) = -1; } /* }}} */