bug #14362 [Debug] Scream as LogLevel::DEBUG (but for fatal errors / uncaught exceptions) (nicolas-grekas)
This PR was merged into the 2.6 branch.
Discussion
----------
[Debug] Scream as LogLevel::DEBUG (but for fatal errors / uncaught exceptions)
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #14353
| License | MIT
| Doc PR | -
Commits
-------
3450122
[Debug] Scream as LogLevel::DEBUG (but for fatal errors / uncaught exceptions)
This commit is contained in:
commit
b9930273de
@ -101,7 +101,7 @@ class ErrorHandler
|
|||||||
private static $stackedErrorLevels = array();
|
private static $stackedErrorLevels = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same init value as thrownErrors
|
* Same init value as thrownErrors.
|
||||||
*
|
*
|
||||||
* @deprecated since 2.6, to be removed in 3.0.
|
* @deprecated since 2.6, to be removed in 3.0.
|
||||||
*/
|
*/
|
||||||
@ -415,7 +415,7 @@ class ErrorHandler
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$this->isRecursive = true;
|
$this->isRecursive = true;
|
||||||
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
|
$this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
|
||||||
$this->isRecursive = false;
|
$this->isRecursive = false;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->isRecursive = false;
|
$this->isRecursive = false;
|
||||||
@ -437,13 +437,12 @@ class ErrorHandler
|
|||||||
*/
|
*/
|
||||||
public function handleException(\Exception $exception, array $error = null)
|
public function handleException(\Exception $exception, array $error = null)
|
||||||
{
|
{
|
||||||
$level = error_reporting();
|
if ($this->loggedErrors & E_ERROR) {
|
||||||
if ($this->loggedErrors & E_ERROR & ($level | $this->screamedErrors)) {
|
|
||||||
$e = array(
|
$e = array(
|
||||||
'type' => E_ERROR,
|
'type' => E_ERROR,
|
||||||
'file' => $exception->getFile(),
|
'file' => $exception->getFile(),
|
||||||
'line' => $exception->getLine(),
|
'line' => $exception->getLine(),
|
||||||
'level' => $level,
|
'level' => error_reporting(),
|
||||||
'stack' => $exception->getTrace(),
|
'stack' => $exception->getTrace(),
|
||||||
);
|
);
|
||||||
if ($exception instanceof FatalErrorException) {
|
if ($exception instanceof FatalErrorException) {
|
||||||
@ -547,7 +546,7 @@ class ErrorHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unstacks stacked errors and forwards to the logger
|
* Unstacks stacked errors and forwards to the logger.
|
||||||
*/
|
*/
|
||||||
public static function unstackErrors()
|
public static function unstackErrors()
|
||||||
{
|
{
|
||||||
@ -666,7 +665,7 @@ class ErrorHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private class used to work around https://bugs.php.net/54275
|
* Private class used to work around https://bugs.php.net/54275.
|
||||||
*
|
*
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
* @author Nicolas Grekas <p@tchwork.com>
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user