bug42937.phpt 744 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Bug #42937 (__call() method not invoked when methods are called on parent from child class)
  3. --FILE--
  4. <?php
  5. class A {
  6. function __call($strMethod, $arrArgs) {
  7. echo "$strMethod\n";
  8. }
  9. }
  10. class C {
  11. function __call($strMethod, $arrArgs) {
  12. echo "$strMethod\n";
  13. }
  14. }
  15. class B extends A {
  16. function test() {
  17. self::test1();
  18. parent::test2();
  19. static::test3();
  20. A::test4();
  21. B::test5();
  22. C::test6();
  23. }
  24. }
  25. $a = new A();
  26. $a->test();
  27. $b = new B();
  28. $b->test();
  29. ?>
  30. --EXPECTF--
  31. test
  32. test1
  33. test2
  34. test3
  35. test4
  36. test5
  37. Fatal error: Uncaught Error: Call to undefined method C::test6() in %s:%d
  38. Stack trace:
  39. #0 %s(%d): B->test()
  40. #1 {main}
  41. thrown in %sbug42937.php on line 21