[php-src] master: Zend: grab closure info for FCC directly in Closure::__invoke()

From: Date: Sun, 22 Nov 2026 15:03:30 +0000
Subject: [php-src] master: Zend: grab closure info for FCC directly in Closure::__invoke()
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144027@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Date: 2026-11-22T15:03:26Z Commit: https://github.com/php/php-src/commit/76ecd0ab0deb4d1b6e3ee4a600306ffc39e4787f Raw diff: https://github.com/php/php-src/commit/76ecd0ab0deb4d1b6e3ee4a600306ffc39e4787f.diff Zend: grab closure info for FCC directly in Closure::__invoke() This only affects direct calls to Closure->__invoke(). Changed paths: M Zend/zend_closures.c Diff: diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 76fecf928c70..87779dabd09e 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);

« previous php.cvs (#144027) next »