bug61025.phpt 675 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #61025 (__invoke() visibility not honored)
  3. --FILE--
  4. <?php
  5. Interface InvokeAble {
  6. static function __invoke();
  7. }
  8. class Bar {
  9. private function __invoke() {
  10. return __CLASS__;
  11. }
  12. }
  13. $b = new Bar;
  14. echo $b();
  15. echo $b->__invoke();
  16. ?>
  17. --EXPECTF--
  18. Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
  19. Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
  20. Bar
  21. Fatal error: Uncaught Error: Call to private method Bar::__invoke() from context '' in %sbug61025.php:%d
  22. Stack trace:
  23. #0 {main}
  24. thrown in %sbug61025.php on line %d