Skip to content

Commit

Permalink
Merge pull request #595 from ro0NL/ro0NL-patch-1
Browse files Browse the repository at this point in the history
SF6: catch SessionNotFoundException
  • Loading branch information
dbu committed Aug 3, 2023
2 parents 3243682 + 84e6869 commit 10708bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/EventListener/FlashMessageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
Expand Down Expand Up @@ -82,7 +83,12 @@ public function onKernelResponse(FlashMessageResponseEvent $event)
return;
}

$session = $this->session ?: $event->getRequest()->getSession();
try {
$session = $this->session ?: $event->getRequest()->getSession();
} catch (SessionNotFoundException $e) {
return;
}

if (null === $session) {
return;
}
Expand Down

0 comments on commit 10708bf

Please sign in to comment.