Skip to content

Commit cbe7ba6

Browse files
author
Tobias Feijten
committed
Check whether a request has a session to prevent deprecation notice
1 parent aff914d commit cbe7ba6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Controller/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct($serializer, ExposedRoutesExtractorInterface $expose
6868
*/
6969
public function indexAction(Request $request, $_format)
7070
{
71-
$session = $request->getSession();
71+
$session = $request->hasSession() ? $request->getSession() : null;
7272

7373
if ($request->hasPreviousSession() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
7474
// keep current flashes for one more request if using AutoExpireFlashBag

0 commit comments

Comments
 (0)