[Debug] Made code in ErrorHandler easier to read

This commit is contained in:
Grégoire Pineau 2015-04-02 14:57:42 +02:00
parent ba84ac87b8
commit 15ef182b99

View File

@ -356,7 +356,10 @@ class ErrorHandler
$throw = $this->thrownErrors & $type & $level;
$type &= $level | $this->screamedErrors;
if ($type && ($log || $throw)) {
if (!$type || (!$log && !$throw)) {
return $type && $log;
}
if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS']) && ($this->scopedErrors & $type)) {
$e = $context; // Whatever the signature of the method,
unset($e['GLOBALS'], $context); // $context is always a reference in 5.3
@ -420,7 +423,6 @@ class ErrorHandler
throw $e;
}
}
}
return $type && $log;
}
@ -487,10 +489,15 @@ class ErrorHandler
public static function handleFatalError(array $error = null)
{
self::$reservedMemory = '';
$handler = set_error_handler('var_dump', 0);
$handler = is_array($handler) ? $handler[0] : null;
restore_error_handler();
if ($handler instanceof self) {
if (!$handler instanceof self) {
return;
}
if (null === $error) {
$error = error_get_last();
}
@ -522,7 +529,6 @@ class ErrorHandler
// Ignore this re-throw
}
}
}
/**
* Configures the error handler for delayed handling.