3 ms·
The best thing to do is convert all your PHP errors into exceptions: function errorToExceptionHandler($errNo, $errStr, $errFile, $errLine, $errContext)
by wvenable 18y ago
The best thing to do is convert all your PHP errors into exceptions:
function errorToExceptionHandler($errNo, $errStr, $errFile, $errLine, $errContext)
{
if (error_reporting() == 0) return;
throw new ErrorException($errStr, 0, $errNo, $errFile, $errLine);
}
set_error_handler('errorToExceptionHandler');
You get a complete stack trace and try/catch handling of errors. It will throw even for notices and warnings, but that's a good thing.