Skip to content

Commit

Permalink
Ignore session in stateless requests
Browse files Browse the repository at this point in the history
Changed to same code as in toolbarAction from symfony 6.3 WebProfilerBundle/Controller/ProfilerController.php
  • Loading branch information
cbcf authored and tobias-93 committed Jan 23, 2024
1 parent 8aaf3ae commit 77de7e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Controller/Controller.php
Expand Up @@ -50,9 +50,9 @@ public function __construct(

public function indexAction(Request $request, $_format): Response
{
$session = $request->hasSession() ? $request->getSession() : null;

if ($request->hasPreviousSession() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
if (!$request->attributes->getBoolean('_stateless') && $request->hasSession()
&& ($session = $request->getSession())->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag
) {
// keep current flashes for one more request if using AutoExpireFlashBag
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
}
Expand Down

0 comments on commit 77de7e4

Please sign in to comment.