8000 bug #14362 [Debug] Scream as LogLevel::DEBUG (but for fatal errors / … · symfony/symfony@b993027 · GitHub
[go: up one dir, main page]

Skip to content

Commit b993027

Browse files
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)
2 parents 4545af2 + 3450122 commit b993027

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class ErrorHandler
101101
private static $stackedErrorLevels = array();
102102

103103
/**
104-
* Same init value as thrownErrors
104+
* Same init value as thrownErrors.
105105
*
106106
* @deprecated since 2.6, to be removed in 3.0.
107107
*/
@@ -415,7 +415,7 @@ public function handleError($type, $message, $file, $line, array $context)
415415
} else {
416416
try {
417417
$this->isRecursive = true;
418-
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
418+
$this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
419419
$this->isRecursive = false;
420420
} catch (\Exception $e) {
421421
$this->isRecursive = false;
@@ -437,13 +437,12 @@ public function handleError($type, $message, $file, $line, array $context)
437437
*/
438438
public function handleException(\Exception $exception, array $error = null)
439439
{
440-
$level = error_reporting();
441-
if ($this->loggedErrors & E_ERROR & ($level | $this->screamedErrors)) {
440+
if ($this->loggedErrors & E_ERROR) {
442441
$e = array(
443442
'type' => E_ERROR,
444443
'file' => $exception->getFile(),
445444
'line' => $exception->getLine(),
446-
'level' => $level,
445+
'level' => error_reporting(),
447446
'stack' => $exception->getTrace(),
448447
);
449448
if ($exception instanceof FatalErrorException) {
@@ -547,7 +546,7 @@ public static function stackErrors()
547546
}
548547

549548
/**
550-
* Unstacks stacked errors and forwards to the logger
549+
* Unstacks stacked errors and forwards to the logger.
551550
*/
552551
public static function unstackErrors()
553552
{
@@ -666,7 +665,7 @@ public function handleFatal()
666665
}
667666

668667
/**
669-
* Private class used to work around https://bugs.php.net/54275
668+
* Private class used to work around https://bugs.php.net/54275.
670669
*
671670
* @author Nicolas Grekas <p@tchwork.com>
672671
*

0 commit comments

Comments
 (0)
0