Commit 9b5f5e7992d for php.net

commit 9b5f5e7992dbce868e6a183cf99ec860e7bdd6ce
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date:   Thu Jul 2 14:07:44 2026 -0700

    Reflection: remove `reflection_extension_factory()`, avoid extra lookups

    `reflection_extension_factory()` was used to initialize a `ReflectionExtension`
    instance based on the name of the extension. It would look for an extension
    with the given name in the global `module_registry` and, if found, delegate to
    `reflection_extension_factory_ex()` to do the actual initialization using the
    located `zend_module_entry` pointer. However, both callers of
    `reflection_extension_factory()` already had a `zend_module_entry` pointer!

    Replace both uses of `reflection_extension_factory()` with
    `reflection_extension_factory_ex()` using the available pointer, and remove the
    `reflection_extension_factory()` method. In a follow-up commit the _ex variant
    will be renamed to remove the suffix.

diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index b120e8e4eb9..a683989a487 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1408,19 +1408,6 @@ static void reflection_extension_factory_ex(zval *object, zend_module_entry *mod
 }
 /* }}} */

-/* {{{ reflection_extension_factory */
-static void reflection_extension_factory(zval *object, const char *name_str)
-{
-	size_t name_len = strlen(name_str);
-	struct _zend_module_entry *module = zend_hash_str_find_ptr_lc(&module_registry, name_str, name_len);
-	if (!module) {
-		return;
-	}
-
-	reflection_extension_factory_ex(object, module);
-}
-/* }}} */
-
 /* {{{ reflection_parameter_factory */
 static void reflection_parameter_factory(zend_function *fptr, zval *closure_object, struct _zend_arg_info *arg_info, uint32_t offset, bool required, zval *object)
 {
@@ -2259,7 +2246,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, getExtension)

 	internal = (zend_internal_function *)fptr;
 	if (internal->module) {
-		reflection_extension_factory(return_value, internal->module->name);
+		reflection_extension_factory_ex(return_value, internal->module);
 	} else {
 		RETURN_NULL();
 	}
@@ -5580,7 +5567,7 @@ ZEND_METHOD(ReflectionClass, getExtension)
 	GET_REFLECTION_OBJECT_PTR(ce);

 	if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module) {
-		reflection_extension_factory(return_value, ce->info.internal.module->name);
+		reflection_extension_factory_ex(return_value, ce->info.internal.module);
 	}
 }
 /* }}} */