| 1 |
<?php |
| 2 |
// Throw exceptions on all PHP errors/warnings/notices. |
| 3 |
// We'd like to do this in all situations (and not just when running tests), but |
| 4 |
// this is a global setting and other code might not be ready for it. |
| 5 |
/** @internal */ |
| 6 |
function error_to_exception($errno, $errstr, $errfile, $errline, $context) |
| 7 |
{ |
| 8 |
// If the error is being suppressed with '@', don't throw an exception. |
| 9 |
if (error_reporting() === 0) return; |
| 10 |
|
| 11 |
throw new ErrorException($errstr, 0, $errno, $errfile, $errline); |
| 12 |
} |
| 13 |
set_error_handler('error_to_exception'); |
| 14 |
|