TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
728 B
42 lines
728 B
--TEST--
|
|
Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
|
|
--FILE--
|
|
<?php
|
|
class A
|
|
{
|
|
protected function Test()
|
|
{
|
|
echo 'Hello from '.get_class($this)."\n";
|
|
}
|
|
|
|
public function call($method, $args = array())
|
|
{
|
|
$this->Test();
|
|
$this->$method();
|
|
call_user_func(array($this, $method));
|
|
}
|
|
}
|
|
|
|
class B extends A
|
|
{
|
|
protected function Test()
|
|
{
|
|
echo 'Overridden hello from '.get_class($this)."\n";
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
$a = new A;
|
|
$b = new B;
|
|
|
|
$a->call('Test');
|
|
$b->call('Test');
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
Hello from A
|
|
Hello from A
|
|
Hello from A
|
|
Overridden hello from B
|
|
Overridden hello from B
|
|
Overridden hello from B
|
|
|