bug46246.phpt 657 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. public function call($method, $args = array())
  12. {
  13. $this->Test();
  14. $this->$method();
  15. call_user_func(array($this, $method));
  16. }
  17. }
  18. class B extends A
  19. {
  20. protected function Test()
  21. {
  22. echo 'Overridden hello from '.get_class($this)."\n";
  23. }
  24. }
  25. $a = new A;
  26. $b = new B;
  27. $a->call('Test');
  28. $b->call('Test');
  29. ?>
  30. --EXPECT--
  31. Hello from A
  32. Hello from A
  33. Hello from A
  34. Hello from B
  35. Hello from B
  36. Hello from B