From cbe7ba6817c7bf9b9d908d149dd8b9f9f0dd3628 Mon Sep 17 00:00:00 2001 From: Tobias Feijten Date: Sun, 10 Jun 2018 21:26:42 +0200 Subject: [PATCH] Check whether a request has a session to prevent deprecation notice --- Controller/Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/Controller.php b/Controller/Controller.php index aea785f0..d760ce9b 100644 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -68,7 +68,7 @@ public function __construct($serializer, ExposedRoutesExtractorInterface $expose */ public function indexAction(Request $request, $_format) { - $session = $request->getSession(); + $session = $request->hasSession() ? $request->getSession() : null; if ($request->hasPreviousSession() && $session->getFlashBag() instanceof AutoExpireFlashBag) { // keep current flashes for one more request if using AutoExpireFlashBag