Skip to content

Commit

Permalink
[WebProfilerBundle] fix FC with HttpFoundation v5
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jun 9, 2019
1 parent a1d07a9 commit 1872a5a
Showing 1 changed file with 7 additions and 5 deletions.
Expand Up @@ -140,9 +140,7 @@ public function toolbarAction(Request $request, $token)
throw new NotFoundHttpException('The profiler must be enabled.');
}

$session = $request->getSession();

if (null !== $session && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
if ($request->hasSession() && ($session = $request->getSession()) && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
// keep current flashes for one more request if using AutoExpireFlashBag
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
}
Expand Down Expand Up @@ -199,7 +197,7 @@ public function searchBarAction(Request $request)
$this->cspHandler->disableCsp();
}

if (null === $session = $request->getSession()) {
if (!$request->hasSession()) {
$ip =
$method =
$statusCode =
Expand All @@ -209,6 +207,8 @@ public function searchBarAction(Request $request)
$limit =
$token = null;
} else {
$session = $request->getSession();

$ip = $request->query->get('ip', $session->get('_profiler_search_ip'));
$method = $request->query->get('method', $session->get('_profiler_search_method'));
$statusCode = $request->query->get('status_code', $session->get('_profiler_search_status_code'));
Expand Down Expand Up @@ -308,7 +308,9 @@ public function searchAction(Request $request)
$limit = $request->query->get('limit');
$token = $request->query->get('token');

if (null !== $session = $request->getSession()) {
if ($request->hasSession()) {
$session = $request->getSession();

$session->set('_profiler_search_ip', $ip);
$session->set('_profiler_search_method', $method);
$session->set('_profiler_search_status_code', $statusCode);
Expand Down

0 comments on commit 1872a5a

Please sign in to comment.