From 7820776bbd523332bb860854bcd482d1b4128527 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Wed, 3 May 2023 19:59:23 +0200 Subject: [PATCH] [WebProfilerBundle] Profiler respect stateless attribute --- .../Controller/ProfilerController.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index b9a861df38dd2..4f0e052226c92 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -128,7 +128,9 @@ public function toolbarAction(Request $request, string $token = null): Response throw new NotFoundHttpException('The profiler must be enabled.'); } - if ($request->hasSession() && ($session = $request->getSession())->isStarted() && $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()); } @@ -172,7 +174,11 @@ public function searchBarAction(Request $request): Response $this->cspHandler?->disableCsp(); - $session = $request->hasSession() ? $request->getSession() : null; + + $session = null; + if ($request->attributes->getBoolean('_stateless') && $request->hasSession()) { + $session = $request->getSession(); + } return new Response( $this->twig->render('@WebProfiler/Profiler/search.html.twig', [ @@ -247,7 +253,7 @@ public function searchAction(Request $request): Response $limit = $request->query->get('limit'); $token = $request->query->get('token'); - if ($request->hasSession()) { + if (!$request->attributes->getBoolean('_stateless') && $request->hasSession()) { $session = $request->getSession(); $session->set('_profiler_search_ip', $ip); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy