From 0f079938a2bcf76d5aa5ae93a966b94be574e369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 9 Mar 2026 23:23:40 +0100 Subject: [PATCH] reflection: Simplify check for `Closure::__invoke()` in `instantiate_reflection_method()` --- ext/reflection/php_reflection.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 2692e1928068d..3b471caffbf61 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3302,10 +3302,7 @@ static void instantiate_reflection_method(INTERNAL_FUNCTION_PARAMETERS, bool is_ lcname = zend_str_tolower_dup(method_name, method_name_len); - if (ce == zend_ce_closure && orig_obj && (method_name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) - && memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0 - && (mptr = zend_get_closure_invoke_method(orig_obj)) != NULL) - { + if (is_closure_invoke(ce, lcname) && orig_obj && (mptr = zend_get_closure_invoke_method(orig_obj)) != NULL) { /* Store the original closure object so we can validate it in invoke/invokeArgs. * Each closure has a unique __invoke signature, so we must reject different closures. */ ZVAL_OBJ_COPY(&intern->obj, orig_obj);