exception_016.phpt 491 B

12345678910111213141516171819
  1. --TEST--
  2. Exceptions on improper usage of $this
  3. --FILE--
  4. <?php
  5. try {
  6. $this->foo();
  7. } catch (Error $e) {
  8. echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
  9. }
  10. $this->foo();
  11. ?>
  12. --EXPECTF--
  13. Exception: Using $this when not in object context in %sexception_016.php on line %d
  14. Fatal error: Uncaught Error: Using $this when not in object context in %sexception_016.php:%d
  15. Stack trace:
  16. #0 {main}
  17. thrown in %sexception_016.php on line %d