bug48533.phpt 776 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Bug #48533 (__callStatic is not invoked for private/protected methods)
  3. --FILE--
  4. <?php
  5. class foo {
  6. private function a() {
  7. var_dump(1);
  8. }
  9. public function b() {
  10. var_dump(2);
  11. }
  12. protected function c() {
  13. var_dump(3);
  14. }
  15. static function __callstatic($a, $b) {
  16. var_dump('__callStatic::'. $a);
  17. }
  18. public function __call($a, $b) {
  19. var_dump('__call::'. $a);
  20. }
  21. }
  22. $x = new foo;
  23. $x->a();
  24. $x->b();
  25. $x->c();
  26. $x::a();
  27. $x::c();
  28. $x::b();
  29. ?>
  30. --EXPECTF--
  31. string(9) "__call::a"
  32. int(2)
  33. string(9) "__call::c"
  34. string(15) "__callStatic::a"
  35. string(15) "__callStatic::c"
  36. Fatal error: Uncaught Error: Non-static method foo::b() cannot be called statically in %s:%d
  37. Stack trace:
  38. #0 {main}
  39. thrown in %s on line %d