[PHP-CVS] [php-src] master: Zend: Avoid temporary lowercase static method names

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

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

Zend: Avoid temporary lowercase static method names

Changed paths:
  M  Zend/zend_object_handlers.c


Diff:

diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index f3b925cdeb31..45b6be2cc9eb 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -2061,17 +2061,14 @@ static zend_always_inline zend_function *get_static_method_fallback(
 
 ZEND_API zend_function *zend_std_get_static_method(const zend_class_entry *ce, zend_string *function_name, const zval *key) /* {{{ */
 {
-	zend_string *lc_function_name;
+	zend_function *fbc;
 	if (EXPECTED(key != NULL)) {
-		lc_function_name = Z_STR_P(key);
+		fbc = zend_hash_find_ptr(&ce->function_table, Z_STR_P(key));
 	} else {
-		lc_function_name = zend_string_tolower(function_name);
+		fbc = zend_hash_find_ptr_lc(&ce->function_table, function_name);
 	}
 
-	zend_function *fbc;
-	zval *func = zend_hash_find(&ce->function_table, lc_function_name);
-	if (EXPECTED(func)) {
-		fbc = Z_FUNC_P(func);
+	if (EXPECTED(fbc)) {
 		if (!(fbc->common.fn_flags & ZEND_ACC_PUBLIC)) {
 			const zend_class_entry *scope = zend_get_executed_scope();
 			ZEND_ASSERT(!(fbc->common.fn_flags & ZEND_ACC_PUBLIC));
@@ -2087,10 +2084,6 @@ ZEND_API zend_function *zend_std_get_static_method(const zend_class_entry *ce, z
 		fbc = get_static_method_fallback(ce, function_name);
 	}
 
-	if (UNEXPECTED(!key)) {
-		zend_string_release_ex(lc_function_name, 0);
-	}
-
 	if (EXPECTED(fbc)) {
 		if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) {
 			zend_abstract_method_call(fbc);
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.