| @@ 38-51 (lines=14) @@ | ||
| 35 | ||
| 36 | // Trigger E_WARNING error with backtrace |
|
| 37 | ||
| 38 | class ErrorTestClass { |
|
| 39 | ||
| 40 | public function __construct() { |
|
| 41 | $this->method1(array(1, 2), new stdClass()); // this arguments will be displayed in error backtrace |
|
| 42 | } |
|
| 43 | ||
| 44 | protected function method1($a, $b) { |
|
| 45 | $this->method2('some long string argument'); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function method2($c) { |
|
| 49 | file_get_contents('not_existed.file'); // E_WARNING error |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | new ErrorTestClass(); |
|
| 54 | ||
| @@ 11-25 (lines=15) @@ | ||
| 8 | ||
| 9 | // Example of handling error with some backtrace |
|
| 10 | ||
| 11 | class ErrorTestClass { |
|
| 12 | ||
| 13 | public function __construct() { |
|
| 14 | $this->method1(array(1, 2), new stdClass()); // this arguments will be displayed in error backtrace |
|
| 15 | } |
|
| 16 | ||
| 17 | protected function method1($a, $b) { |
|
| 18 | $this->method2('some long string argument'); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function method2($c) { |
|
| 22 | echo $undefinedVar; // E_NOTICE error |
|
| 23 | file_get_contents('not_existed.file'); // E_WARNING error |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| 27 | new ErrorTestClass(); |
|
| 28 | ||