2008-10-10 15:19:22 +00:00
|
|
|
--TEST--
|
|
|
|
Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
class A
|
|
|
|
{
|
2020-02-03 21:52:20 +00:00
|
|
|
private function Test()
|
|
|
|
{
|
|
|
|
echo 'Hello from '.get_class($this)."\n";
|
|
|
|
}
|
2018-09-16 17:16:42 +00:00
|
|
|
|
2020-02-03 21:52:20 +00:00
|
|
|
public function call($method, $args = array())
|
|
|
|
{
|
|
|
|
$this->Test();
|
|
|
|
$this->$method();
|
|
|
|
call_user_func(array($this, $method));
|
|
|
|
}
|
2008-10-10 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class B extends A
|
|
|
|
{
|
2020-02-03 21:52:20 +00:00
|
|
|
protected function Test()
|
|
|
|
{
|
|
|
|
echo 'Overridden hello from '.get_class($this)."\n";
|
|
|
|
}
|
2008-10-10 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$a = new A;
|
|
|
|
$b = new B;
|
|
|
|
|
|
|
|
$a->call('Test');
|
|
|
|
$b->call('Test');
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
Hello from A
|
|
|
|
Hello from A
|
|
|
|
Hello from A
|
|
|
|
Hello from B
|
|
|
|
Hello from B
|
|
|
|
Hello from B
|