[php-src] master: Fix failing zend_vm_init_call_frame assertion
| From: | Matteo Beccati | Date: | Tue, 24 Nov 2026 12:21:33 +0000 |
| Subject: | [php-src] master: Fix failing zend_vm_init_call_frame assertion | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144105@lists.php.net to get a copy of this message | ||
Author: Matteo Beccati (mbeccati)
Date: 2026-11-24T13:20:53+01:00
Commit: https://github.com/php/php-src/commit/122fa14384ff8746156f8dceafc2cbf7cd1486d1
Raw diff: https://github.com/php/php-src/commit/122fa14384ff8746156f8dceafc2cbf7cd1486d1.diff
Fix failing zend_vm_init_call_frame assertion
Just a typo in 6a6d54fa
Changed paths:
A ext/reflection/tests/invoke_static_closure_scope.phpt
M ext/reflection/php_reflection.c
Diff:
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index f0bf1690e4e3..bbe805a81479 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 000000000000..8e75899fa578
--- /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