[ErrorHandler] fix handling buffered SilencedErrorContext

This commit is contained in:
Nicolas Grekas 2021-06-21 14:19:38 +02:00
parent ffb0d2d424
commit 07407c74ca
2 changed files with 8 additions and 3 deletions

View File

@ -17,7 +17,7 @@
$status = 'warning';
} else {
$severity = 0;
if (($exception = $log['context']['exception'] ?? null) instanceof \ErrorException) {
if (($exception = $log['context']['exception'] ?? null) instanceof \ErrorException || $exception instanceof \Symfony\Component\ErrorHandler\Exception\SilencedErrorContext) {
$severity = $exception->getSeverity();
}
$status = \E_DEPRECATED === $severity || \E_USER_DEPRECATED === $severity ? 'warning' : 'normal';

View File

@ -11,14 +11,19 @@
namespace Symfony\Component\ErrorHandler;
use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext;
/**
* @internal
*/
class ThrowableUtils
{
public static function getSeverity(\Throwable $throwable): int
/**
* @param SilencedErrorContext|\Throwable
*/
public static function getSeverity($throwable): int
{
if ($throwable instanceof \ErrorException) {
if ($throwable instanceof \ErrorException || $throwable instanceof SilencedErrorContext) {
return $throwable->getSeverity();
}