Skip to content

Commit a892647

Browse files
committed
Set called_scope in __callStatic closure trampoline
1 parent 338a47b commit a892647

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Zend/tests/first_class_callable_005.phpt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,25 @@ class Foo {
88
}
99

1010
public static function __callStatic($method, $args) {
11-
return $method;
11+
return static::class . "::" . $method;
1212
}
1313
}
1414

15+
class Bar extends Foo {}
16+
1517
$foo = new Foo;
1618
$bar = $foo->anythingInstance(...);
1719

18-
echo $bar() . PHP_EOL;
20+
echo $bar(), "\n";
1921

2022
$qux = Foo::anythingStatic(...);
23+
echo $qux(), "\n";
24+
25+
$qux2 = Bar::anythingStatic(...);
26+
echo $qux2(), "\n";
2127

22-
echo $qux();
2328
?>
2429
--EXPECT--
2530
anythingInstance
26-
anythingStatic
31+
Foo::anythingStatic
32+
Bar::anythingStatic

Zend/zend_closures.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
282282
}
283283

284284
fcc.object = fci.object = Z_OBJ_P(ZEND_THIS);
285+
fcc.called_scope = zend_get_called_scope(EG(current_execute_data));
285286

286287
zend_call_function(&fci, &fcc);
287288

0 commit comments

Comments
 (0)