Set called_scope in __callStatic closure trampoline

This commit is contained in:
Nikita Popov 2021-07-23 10:58:05 +02:00
parent 338a47bb85
commit a8926474cb
2 changed files with 11 additions and 4 deletions

View file

@ -8,19 +8,25 @@ class Foo {
}
public static function __callStatic($method, $args) {
return $method;
return static::class . "::" . $method;
}
}
class Bar extends Foo {}
$foo = new Foo;
$bar = $foo->anythingInstance(...);
echo $bar() . PHP_EOL;
echo $bar(), "\n";
$qux = Foo::anythingStatic(...);
echo $qux(), "\n";
$qux2 = Bar::anythingStatic(...);
echo $qux2(), "\n";
echo $qux();
?>
--EXPECT--
anythingInstance
anythingStatic
Foo::anythingStatic
Bar::anythingStatic

View file

@ -282,6 +282,7 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
}
fcc.object = fci.object = Z_OBJ_P(ZEND_THIS);
fcc.called_scope = zend_get_called_scope(EG(current_execute_data));
zend_call_function(&fci, &fcc);