Skip to content

Commit

Permalink
bug #42979 [FrameworkBundle] fix session-related BC layer triggering …
Browse files Browse the repository at this point in the history
…deprecation (nicolas-grekas)

This PR was merged into the 5.3 branch.

Discussion
----------

[FrameworkBundle] fix session-related BC layer triggering deprecation

| Q             | A
| ------------- | ---
| Branch?       | 5.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Needed to make ##42959 green.

Commits
-------

18ab810 [FrameworkBundle] fix session-related BC layer triggering deprecation
  • Loading branch information
nicolas-grekas committed Sep 10, 2021
2 parents 0584295 + 18ab810 commit 36aff48
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ public function loginUser(object $user, string $firewallContext = 'main'): self
$container = $this->getContainer();
$container->get('security.untracked_token_storage')->setToken($token);

if (!$container->has('session') && !$container->has('session_factory')) {
if ($container->has('session.factory')) {
$session = $container->get('session.factory')->createSession();
} elseif ($container->has('session')) {
$session = $container->get('session');
} else {
return $this;
}

$session = $container->get($container->has('session') ? 'session' : 'session_factory');
$session->set('_security_'.$firewallContext, serialize($token));
$session->save();

Expand Down

0 comments on commit 36aff48

Please sign in to comment.