Commit 0f4fd2d03c3 for php.net
commit 0f4fd2d03c301c3bac1646cf03355f5054cf0b30
Author: Gina Peter Banyard <girgias@php.net>
Date: Sun Jan 11 19:57:07 2026 +0000
ext/spl: use ZPP specifier that doesn't free trampoline for spl_autoload_unregister()
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 873f1e3a83e..35cc7d42691 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -485,11 +485,12 @@ PHP_FUNCTION(spl_autoload_unregister)
zend_fcall_info_cache fcc;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_FUNC(fci, fcc)
+ Z_PARAM_FUNC_NO_TRAMPOLINE_FREE(fci, fcc)
ZEND_PARSE_PARAMETERS_END();
- if (fcc.function_handler && zend_string_equals_literal(
- fcc.function_handler->common.function_name, "spl_autoload_call")) {
+ if (zend_string_equals_literal(fcc.function_handler->common.function_name, "spl_autoload_call")) {
+ /* Release trampoline */
+ zend_release_fcall_info_cache(&fcc);
php_error_docref(NULL, E_DEPRECATED,
"Using spl_autoload_call() as a callback for spl_autoload_unregister() is deprecated,"
" to remove all registered autoloaders, call spl_autoload_unregister()"
@@ -504,13 +505,6 @@ PHP_FUNCTION(spl_autoload_unregister)
RETURN_TRUE;
}
- if (!fcc.function_handler) {
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
- * with it ourselves. It is important that it is not refetched on every call,
- * because calls may occur from different scopes. */
- zend_is_callable_ex(&fci.function_name, NULL, 0, NULL, &fcc, NULL);
- }
-
Bucket *p = spl_find_registered_function(&fcc);
/* Release trampoline */
zend_release_fcall_info_cache(&fcc);