Commit 122fa14384f for php
commit 122fa14384ff8746156f8dceafc2cbf7cd1486d1
Author: Matteo Beccati <mbeccati@php.net>
Date: Tue Nov 24 13:17:46 2026 +0100
Fix failing zend_vm_init_call_frame assertion
Just a typo in 6a6d54fa
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index f0bf1690e4e..bbe805a8147 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2065,7 +2065,7 @@ ZEND_METHOD(ReflectionFunction, invoke)
fcc.object = NULL;
if (!Z_ISUNDEF(intern->obj)) {
- zend_get_closure(Z_OBJ(intern->obj), &fcc.calling_scope, &fcc.function_handler, &fcc.object, false);
+ zend_get_closure(Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, false);
}
zval retval;
diff --git a/ext/reflection/tests/invoke_static_closure_scope.phpt b/ext/reflection/tests/invoke_static_closure_scope.phpt
new file mode 100644
index 00000000000..8e75899fa57
--- /dev/null
+++ b/ext/reflection/tests/invoke_static_closure_scope.phpt
@@ -0,0 +1,23 @@
+--TEST--
+ReflectionFunction::invoke() preserves the called scope of static closures
+--FILE--
+<?php
+class BaseClass
+{
+ public static function callback(): Closure
+ {
+ return static fn () => self::class . ', ' . static::class;
+ }
+}
+
+class ChildClass extends BaseClass
+{
+}
+
+$reflection = new ReflectionFunction(ChildClass::callback());
+echo $reflection->invoke(), "\n";
+echo $reflection->invokeArgs([]), "\n";
+?>
+--EXPECT--
+BaseClass, ChildClass
+BaseClass, ChildClass