indirect_call_string_003.phpt 489 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Dynamic static call to instance method should throw.
  3. --CREDITS--
  4. Aaron Piotrowski <aaron@icicle.io>
  5. --FILE--
  6. <?php
  7. class TestClass
  8. {
  9. private $test;
  10. public function method()
  11. {
  12. $this->test = 'test';
  13. return "Hello, world!\n";
  14. }
  15. }
  16. $callback = 'TestClass::method';
  17. echo $callback();
  18. ?>
  19. --EXPECTF--
  20. Fatal error: Uncaught Error: Non-static method TestClass::method() cannot be called statically in %s:%d
  21. Stack trace:
  22. #0 {main}
  23. thrown in %s on line %d