Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d511de

Browse files
committed
bug #38894 [HttpKernel] Remove Symfony 3 compatibility code (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpKernel] Remove Symfony 3 compatibility code | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #38892 | License | MIT | Doc PR | N/A This PR removes dead code that checks for the presence of the `Request::setSessionFactory()` method. That method was added with #25836 in HttpFoundation 4.1. Since HttpKernel requires at least HttpFoundation 4.4, we can assume that the method is always present and thus simplify some code here. Additionally, I also fix the doc block as described in #38892. 😉 Commits ------- b9ca866 Remove Symfony 3 compatibility code.
2 parents 1afb1bc + b9ca866 commit 2d511de

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class Request
179179
protected $format;
180180

181181
/**
182-
* @var SessionInterface
182+
* @var SessionInterface|callable
183183
*/
184184
protected $session;
185185

src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,8 @@ public function onKernelRequest(GetResponseEvent $event)
5555

5656
$session = null;
5757
$request = $event->getRequest();
58-
if ($request->hasSession()) {
59-
// no-op
60-
} elseif (method_exists($request, 'setSessionFactory')) {
58+
if (!$request->hasSession()) {
6159
$request->setSessionFactory(function () { return $this->getSession(); });
62-
} elseif ($session = $this->getSession()) {
63-
$request->setSession($session);
6460
}
6561

6662
$session = $session ?? ($this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null);

0 commit comments

Comments
 (0)