From 2f6afda40b0f95b38af152f1b339ab02cd07edcd Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 25 Sep 2025 11:57:49 +0100 Subject: [PATCH] Zend/zend_execute_API.c: reduce variable scope --- Zend/zend_execute_API.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 5809e5ad7a5..b51f1546d66 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -270,9 +270,6 @@ void shutdown_destructors(void) /* {{{ */ /* Free values held by the executor. */ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown) { - zend_string *key; - zval *zv; - EG(flags) |= EG_FLAGS_IN_RESOURCE_SHUTDOWN; zend_try { zend_close_rsrc_list(&EG(regular_list)); @@ -282,12 +279,15 @@ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown) EG(active) = 0; if (!fast_shutdown) { + zval *zv; + zend_hash_graceful_reverse_destroy(&EG(symbol_table)); /* Constants may contain objects, destroy them before the object store. */ if (EG(full_tables_cleanup)) { zend_hash_reverse_apply(EG(zend_constants), clean_non_persistent_constant_full); } else { + zend_string *key; ZEND_HASH_MAP_REVERSE_FOREACH_STR_KEY_VAL(EG(zend_constants), key, zv) { zend_constant *c = Z_PTR_P(zv); if (_idx == EG(persistent_constants_count)) { @@ -434,8 +434,6 @@ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown) void shutdown_executor(void) /* {{{ */ { - zend_string *key; - zval *zv; #if ZEND_DEBUG bool fast_shutdown = 0; #elif defined(__SANITIZE_ADDRESS__) @@ -477,6 +475,8 @@ void shutdown_executor(void) /* {{{ */ zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function_full); zend_hash_reverse_apply(EG(class_table), clean_non_persistent_class_full); } else { + zend_string *key; + zval *zv; ZEND_HASH_MAP_REVERSE_FOREACH_STR_KEY_VAL(EG(function_table), key, zv) { zend_function *func = Z_PTR_P(zv); if (_idx == EG(persistent_functions_count)) { @@ -808,7 +808,6 @@ zend_result _call_user_function_impl(zval *object, zval *function_name, zval *re zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */ { - uint32_t i; zend_execute_data *call; zend_fcall_info_cache fci_cache_local; zend_function *func; @@ -871,7 +870,7 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_ } } - for (i=0; iparam_count; i++) { + for (uint32_t i = 0; i < fci->param_count; i++) { zval *param = ZEND_CALL_ARG(call, i+1); zval *arg = &fci->params[i]; bool must_wrap = false;