xref: /PHP-8.2/Zend/tests/bug46246.phpt (revision f8d79582)
1--TEST--
2Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
3--FILE--
4<?php
5class A
6{
7    private function Test()
8    {
9        echo 'Hello from '.get_class($this)."\n";
10    }
11
12    public function call($method, $args = array())
13    {
14        $this->Test();
15        $this->$method();
16        call_user_func(array($this, $method));
17    }
18}
19
20class B extends A
21{
22    protected function Test()
23    {
24        echo 'Overridden hello from '.get_class($this)."\n";
25    }
26}
27
28$a = new A;
29$b = new B;
30
31$a->call('Test');
32$b->call('Test');
33?>
34--EXPECT--
35Hello from A
36Hello from A
37Hello from A
38Hello from B
39Hello from B
40Hello from B
41