[PHP-CVS] [php-src] master: Zend: Use lowercase hash lookup for duplicate function checks

[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/48186fcd4cfeb5b7edd1042bfdf4b99c0ecce1cf
Raw diff: https://github.com/php/php-src/commit/48186fcd4cfeb5b7edd1042bfdf4b99c0ecce1cf.diff

Zend: Use lowercase hash lookup for duplicate function checks

Changed paths:
  M  Zend/zend_API.c


Diff:

diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 6b52080643f1..a03ceb8cd28b 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -3238,12 +3238,9 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
 	if (unload) { /* before unloading, display all remaining bad function in the module */
 		while (ptr->fname) {
 			fname_len = strlen(ptr->fname);
-			lowercase_name = zend_string_alloc(fname_len, 0);
-			zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ptr->fname, fname_len);
-			if (zend_hash_exists(target_function_table, lowercase_name)) {
+			if (zend_hash_str_find_ptr_lc(target_function_table, ptr->fname, fname_len) != NULL) {
 				zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
 			}
-			zend_string_efree(lowercase_name);
 			ptr++;
 		}
 		zend_unregister_functions(functions, count, target_function_table);
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.