Simplified condition and removed unused code from AbstractSessionListener::onKernelRequest

This commit is contained in:
StefanoCappellini 2021-04-10 16:16:03 +02:00 committed by Nicolas Grekas
parent ed576b2554
commit d344b8d6cb

View File

@ -53,14 +53,13 @@ abstract class AbstractSessionListener implements EventSubscriberInterface
return;
}
$session = null;
$request = $event->getRequest();
if (!$request->hasSession()) {
$sess = null;
$request->setSessionFactory(function () use (&$sess) { return $sess ?? $sess = $this->getSession(); });
}
$session = $session ?? ($this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null);
$session = $this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null;
$this->sessionUsageStack[] = $session instanceof Session ? $session->getUsageIndex() : 0;
}