File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
src/Symfony/Component/Debug Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ public function setLoggers(array $loggers)
225225
226226 if ($ flush ) {
227227 foreach ($ this ->bootstrappingLogger ->cleanLogs () as $ log ) {
228- $ type = $ log [2 ]['exception ' ]->getSeverity ();
228+ $ type = $ log [2 ]['exception ' ] instanceof \ErrorException ? $ log [ 2 ][ ' exception ' ] ->getSeverity () : E_ERROR ;
229229 if (!isset ($ flush [$ type ])) {
230230 $ this ->bootstrappingLogger ->log ($ log [0 ], $ log [1 ], $ log [2 ]);
231231 } elseif ($ this ->loggers [$ type ][0 ]) {
Original file line number Diff line number Diff line change @@ -417,6 +417,25 @@ public function testBootstrappingLogger()
417417 $ handler ->setLoggers (array (E_DEPRECATED => array ($ mockLogger , LogLevel::WARNING )));
418418 }
419419
420+ public function testSettingLoggerWhenExceptionIsBuffered ()
421+ {
422+ $ bootLogger = new BufferingLogger ();
423+ $ handler = new ErrorHandler ($ bootLogger );
424+
425+ $ exception = new \Exception ('Foo message ' );
426+
427+ $ mockLogger = $ this ->getMockBuilder ('Psr\Log\LoggerInterface ' )->getMock ();
428+ $ mockLogger ->expects ($ this ->once ())
429+ ->method ('log ' )
430+ ->with (LogLevel::CRITICAL , 'Uncaught Exception: Foo message ' , array ('exception ' => $ exception ));
431+
432+ $ handler ->setExceptionHandler (function () use ($ handler , $ mockLogger ) {
433+ $ handler ->setDefaultLogger ($ mockLogger );
434+ });
435+
436+ $ handler ->handleException ($ exception );
437+ }
438+
420439 public function testHandleFatalError ()
421440 {
422441 try {
You can’t perform that action at this time.
0 commit comments