[php-src] master: Zend: Reuse zend_fetch_function() for dynamic calls

Weilin Du <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Weilin Du (LamentXU123)
Date: 2026-08-16T16:35:06+08:00

Commit: https://github.com/php/php-src/commit/3eeca78fcb68e2d982f4611a219d9852374b1b8f
Raw diff: https://github.com/php/php-src/commit/3eeca78fcb68e2d982f4611a219d9852374b1b8f.diff

Zend: Reuse zend_fetch_function() for dynamic calls

Changed paths:
  M  Zend/zend_execute.c


Diff:

diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 6f3572840d4c..14a340ffee37 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -5103,7 +5103,6 @@ static void zend_swap_operands(zend_op *op) /* {{{ */
 static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_string *function, uint32_t num_args) /* {{{ */
 {
 	zend_function *fbc;
-	zval *func;
 	zend_class_entry *called_scope;
 	zend_string *lcname;
 	const char *colon;
@@ -5155,23 +5154,11 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
 			init_func_run_time_cache(&fbc->op_array);
 		}
 	} else {
-		if (ZSTR_VAL(function)[0] == '\\') {
-			lcname = zend_string_alloc(ZSTR_LEN(function) - 1, 0);
-			zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(function) + 1, ZSTR_LEN(function) - 1);
-		} else {
-			lcname = zend_string_tolower(function);
-		}
-		if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
+		fbc = zend_fetch_function(function);
+		if (UNEXPECTED(fbc == NULL)) {
 			zend_throw_error(NULL, "Call to undefined function %s()", ZSTR_VAL(function));
-			zend_string_release_ex(lcname, 0);
 			return NULL;
 		}
-		zend_string_release_ex(lcname, 0);
-
-		fbc = Z_FUNC_P(func);
-		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
-			init_func_run_time_cache(&fbc->op_array);
-		}
 		called_scope = NULL;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.