diff options
author | Dmitry Stogov <dmitry@php.net> | 2008-10-10 15:19:22 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2008-10-10 15:19:22 +0000 |
commit | a54d8e5d0845cd7230ca4a43eb37c9c49aa3859f (patch) | |
tree | 5e323c7f606cd97abd85ca0d1bd5317aaa354f5b /Zend/tests/bug46246.phpt | |
parent | cdeea98d3721d93f2f7a6fd21c17f23c318855a2 (diff) | |
download | php-git-a54d8e5d0845cd7230ca4a43eb37c9c49aa3859f.tar.gz |
Fixed bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
Diffstat (limited to 'Zend/tests/bug46246.phpt')
-rw-r--r-- | Zend/tests/bug46246.phpt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Zend/tests/bug46246.phpt b/Zend/tests/bug46246.phpt new file mode 100644 index 0000000000..a57222bf2a --- /dev/null +++ b/Zend/tests/bug46246.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method()) +--FILE-- +<?php +class A +{ + private 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"; + } +} + +$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 |