Skip to content

Commit 2ada9f3

Browse files
Merge pull request #46 from pgrimaud/main
Fix exception status code
2 parents 674c0a7 + c2e9c94 commit 2ada9f3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

EventListener/ReplaceImageListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ public function onKernelResponse(ResponseEvent $event)
5959
// Status code is not set by the exception controller but only by the
6060
// kernel at the very end.
6161
// So lets use the status code from the flatten exception instead.
62-
// Unless it comes from a fatal error handler
63-
if ($exception instanceof \Error) {
64-
$statusCode = $exception->getCode();
65-
} else {
62+
// Unless it comes from a fatal error handler or exception base class
63+
if (method_exists($exception, 'getStatusCode')) {
6664
$statusCode = $exception->getStatusCode();
65+
} else {
66+
$statusCode = $exception->getCode();
6767
}
6868

6969
$dir = $this->getGifDir($statusCode);

0 commit comments

Comments
 (0)