Commit 76ecd0ab0de for php
commit 76ecd0ab0deb4d1b6e3ee4a600306ffc39e4787f
Author: Gina Peter Banyard <girgias@php.net>
Date: Mon Aug 24 18:28:58 2026 +0100
Zend: grab closure info for FCC directly in Closure::__invoke()
This only affects direct calls to Closure->__invoke().
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 76fecf928c7..87779dabd09 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -44,7 +44,6 @@ typedef struct _zend_closure {
ZEND_API zend_class_entry *zend_ce_closure;
static zend_object_handlers closure_handlers;
-static zend_result zend_closure_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, bool check_only);
static void zend_create_closure_ex(zval *res, zend_function *func, zend_class_entry *scope, zend_class_entry *called_scope, zend_object *this_ptr, bool is_fake, uint32_t flags);
static inline uint32_t zend_closure_flags(const zend_closure *closure)
@@ -68,11 +67,14 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
Z_PARAM_VARIADIC_WITH_NAMED(args, num_args, named_args)
ZEND_PARSE_PARAMETERS_END();
- zend_fcall_info_cache fcc = {
+ zend_closure *closure = (zend_closure*)Z_OBJ_P(ZEND_THIS);
+ const zend_fcall_info_cache fcc = {
+ .function_handler = &closure->func,
+ .calling_scope = closure->called_scope,
+ .called_scope = closure->called_scope,
+ .object = closure->this_ptr,
.closure = Z_OBJ_P(ZEND_THIS),
};
- zend_closure_get_closure(Z_OBJ_P(ZEND_THIS), &fcc.calling_scope, &fcc.function_handler, &fcc.object, false);
- fcc.called_scope = fcc.calling_scope;
zend_call_known_fcc(&fcc, return_value, num_args, args, named_args);
zend_return_unwrap_ref(execute_data, return_value);