Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 119b3ec

Browse files
bug #41760 [ErrorHandler] fix handling buffered SilencedErrorContext (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [ErrorHandler] fix handling buffered SilencedErrorContext | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41745 | License | MIT | Doc PR | - Commits ------- 07407c7 [ErrorHandler] fix handling buffered SilencedErrorContext
2 parents d35c47b + 07407c7 commit 119b3ec

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Symfony/Component/ErrorHandler/Resources/views/logs.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
$status = 'warning';
1818
} else {
1919
$severity = 0;
20-
if (($exception = $log['context']['exception'] ?? null) instanceof \ErrorException) {
20+
if (($exception = $log['context']['exception'] ?? null) instanceof \ErrorException || $exception instanceof \Symfony\Component\ErrorHandler\Exception\SilencedErrorContext) {
2121
$severity = $exception->getSeverity();
2222
}
2323
$status = \E_DEPRECATED === $severity || \E_USER_DEPRECATED === $severity ? 'warning' : 'normal';

src/Symfony/Component/ErrorHandler/ThrowableUtils.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111

1212
namespace Symfony\Component\ErrorHandler;
1313

14+
use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext;
15+
1416
/**
1517
* @internal
1618
*/
1719
class ThrowableUtils
1820
{
19-
public static function getSeverity(\Throwable $throwable): int
21+
/**
22+
* @param SilencedErrorContext|\Throwable
23+
*/
24+
public static function getSeverity($throwable): int
2025
{
21-
if ($throwable instanceof \ErrorException) {
26+
if ($throwable instanceof \ErrorException || $throwable instanceof SilencedErrorContext) {
2227
return $throwable->getSeverity();
2328
}
2429

0 commit comments

Comments
 (0)