Skip to content

Instantly share code, notes, and snippets.

@asgrim
Created November 13, 2013 14:57
Show Gist options
  • Save asgrim/f7180c73aacebfb8b715 to your computer and use it in GitHub Desktop.
Save asgrim/f7180c73aacebfb8b715 to your computer and use it in GitHub Desktop.
if (is_null($lastError))
{
$lastError = error_get_last();
if (null === $lastError || $lastError['message'] == '')
{
return false;
}
}
$errors = array(E_ERROR, E_USER_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, E_STRICT);
if (in_array($lastError['type'], $errors))
{
$message = isset($lastError['message']) ? $lastError['message'] : '';
$code = isset($lastError['type']) ? $lastError['type'] : E_ERROR;
$file = isset($lastError['file']) ? $lastError['file'] : '';
$line = isset($lastError['line']) ? $lastError['line'] : 0;
// We shouldn't call the previous error handler if shutting down
unset ($this->previousErrorHandler);
$this->handleError($code, $message, $file, $line);
return true;
}
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment