minor #14179 [Debug] Made code in ErrorHandler easier to read (lyrixx)
This PR was merged into the 2.6 branch.
Discussion
----------
[Debug] Made code in ErrorHandler easier to read
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
15ef182
[Debug] Made code in ErrorHandler easier to read
This commit is contained in:
commit
dec2ac917e
@ -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.
|
||||
|
Reference in New Issue
Block a user