Skip to content

Commit

Permalink
Use hasSession() over getSession() to check whether the session e…
Browse files Browse the repository at this point in the history
…xists (mautic#11483)

As `getSession()` will throw an exception in Symfony 5 instead of `null` in Symfony 4
  • Loading branch information
escopecz authored Sep 21, 2022
1 parent f66a55a commit 071484d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
* If we've already sent the response headers, and we have a session
* set in the request, set that as the session in the container.
*/
if (headers_sent() && $request->getSession()) {
if (headers_sent() && $request->hasSession()) {
$this->getContainer()->set('session', $request->getSession());
}

Expand Down

0 comments on commit 071484d

Please sign in to comment.