Annotation of embedaddon/php/Zend/tests/bug46246.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
3: --FILE--
4: <?php
5: class 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:
20: class 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--
35: Hello from A
36: Hello from A
37: Hello from A
38: Hello from B
39: Hello from B
40: Hello from B
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>