public static function ErrorHandler::handleFatalError in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/debug/ErrorHandler.php \Symfony\Component\Debug\ErrorHandler::handleFatalError()
Shutdown registered function for handling PHP fatal errors.
@internal
Parameters
array $error An array as returned by error_get_last():
2 calls to ErrorHandler::handleFatalError()
- ErrorHandler::handleError in vendor/
symfony/ debug/ ErrorHandler.php - Handles errors by filtering then logging them according to the configured bit fields.
- ErrorHandler::handleFatal in vendor/
symfony/ debug/ ErrorHandler.php - Handles PHP fatal errors.
File
- vendor/
symfony/ debug/ ErrorHandler.php, line 522
Class
- ErrorHandler
- A generic ErrorHandler for the PHP engine.
Namespace
Symfony\Component\DebugCode
public static function handleFatalError(array $error = null) {
if (null === self::$reservedMemory) {
return;
}
self::$reservedMemory = null;
$handler = set_error_handler('var_dump', 0);
$handler = is_array($handler) ? $handler[0] : null;
restore_error_handler();
if (!$handler instanceof self) {
return;
}
if (null === $error) {
$error = error_get_last();
}
try {
while (self::$stackedErrorLevels) {
static::unstackErrors();
}
} catch (\Exception $exception) {
// Handled below
}
if ($error && ($error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
// Let's not throw anymore but keep logging
$handler
->throwAt(0, true);
$trace = isset($error['backtrace']) ? $error['backtrace'] : null;
if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
$exception = new OutOfMemoryException($handler->levels[$error['type']] . ': ' . $error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
}
else {
$exception = new FatalErrorException($handler->levels[$error['type']] . ': ' . $error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
}
}
elseif (!isset($exception)) {
return;
}
try {
$handler
->handleException($exception, $error);
} catch (FatalErrorException $e) {
// Ignore this re-throw
}
}