Skip to content

Commit 8ca47c8

Browse files
committed
ext/spl: use ZPP specifier that doesn't free trampoline for spl_autoload_unregister()
1 parent 902f028 commit 8ca47c8

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

ext/spl/php_spl.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,10 @@ PHP_FUNCTION(spl_autoload_unregister)
485485
zend_fcall_info_cache fcc;
486486

487487
ZEND_PARSE_PARAMETERS_START(1, 1)
488-
Z_PARAM_FUNC(fci, fcc)
488+
Z_PARAM_FUNC_NO_TRAMPOLINE_FREE(fci, fcc)
489489
ZEND_PARSE_PARAMETERS_END();
490490

491-
if (fcc.function_handler && zend_string_equals_literal(
492-
fcc.function_handler->common.function_name, "spl_autoload_call")) {
491+
if (zend_string_equals_literal(fcc.function_handler->common.function_name, "spl_autoload_call")) {
493492
php_error_docref(NULL, E_DEPRECATED,
494493
"Using spl_autoload_call() as a callback for spl_autoload_unregister() is deprecated,"
495494
" to remove all registered autoloaders, call spl_autoload_unregister()"
@@ -504,13 +503,6 @@ PHP_FUNCTION(spl_autoload_unregister)
504503
RETURN_TRUE;
505504
}
506505

507-
if (!fcc.function_handler) {
508-
/* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
509-
* with it ourselves. It is important that it is not refetched on every call,
510-
* because calls may occur from different scopes. */
511-
zend_is_callable_ex(&fci.function_name, NULL, 0, NULL, &fcc, NULL);
512-
}
513-
514506
Bucket *p = spl_find_registered_function(&fcc);
515507
/* Release trampoline */
516508
zend_release_fcall_info_cache(&fcc);

0 commit comments

Comments
 (0)