[WebProfilerBundle] fix FC with HttpFoundation v5

This commit is contained in:
Nicolas Grekas 2019-06-09 18:36:33 +02:00
parent a1d07a99cd
commit 1872a5af39

View File

@ -140,9 +140,7 @@ class ProfilerController
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());
}
@ -199,7 +197,7 @@ class ProfilerController
$this->cspHandler->disableCsp();
}
if (null === $session = $request->getSession()) {
if (!$request->hasSession()) {
$ip =
$method =
$statusCode =
@ -209,6 +207,8 @@ class ProfilerController
$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'));
@ -308,7 +308,9 @@ class ProfilerController
$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);