Description
Symfony version(s) affected: 4.4 - 6.0
Description
When we create new instance ErrorHandler
with BufferingLogger
and then attach logger via ErrorHandler ::setLoggers
and BufferingLogger
contains SilencedErrorContext
- we are getting error Argument 1 passed to Symfony\Component\ErrorHandler\ThrowableUtils::getSeverity() must implement interface Throwable, instance of Symfony\Component\ErrorHandler\Exception\SilencedErrorContext given
How to reproduce
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\ErrorHandler\BufferingLogger;
use Psr\Log\LoggerInterface;
$handler = new ErrorHandler(new BufferingLogger(), false);
ErrorHandler::register($handler);
@file ('non_existent_file');
$handler->setDefaultLogger(new LoggerInterface);
Possible Solution
class SilencedErrorContext extends \ErrorException
Additional context
Argument 1 passed to Symfony\Component\ErrorHandler\ThrowableUtils::getSeverity() must implement interface Throwable, instance of Symfony\Component\ErrorHandler\Exception\SilencedErrorContext given