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