File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1818
1919class ReplaceImageListener implements EventSubscriberInterface
2020{
21- private const IMAGES_DIR = '../../Resources/public/images ' ;
22-
2321 /** @var string[][] */
2422 private $ gifs ;
2523
@@ -49,10 +47,16 @@ public function onKernelResponse(ResponseEvent $event)
4947 return ;
5048 }
5149
50+ $ exception = $ event ->getRequest ()->attributes ->get ('exception ' );
5251 // Status code is not set by the exception controller but only by the
5352 // kernel at the very end.
5453 // So lets use the status code from the flatten exception instead.
55- $ statusCode = $ event ->getRequest ()->attributes ->get ('exception ' )->getStatusCode ();
54+ // Unless it comes from a fatal error handler
55+ if ($ exception instanceof \Error) {
56+ $ statusCode = $ exception ->getCode ();
57+ } else {
58+ $ statusCode = $ exception ->getStatusCode ();
59+ }
5660
5761 $ dir = $ this ->getGifDir ($ statusCode );
5862 $ gif = $ this ->getRandomGif ($ dir );
You can’t perform that action at this time.
0 commit comments