AuthenticationUtils::getLastUsername()` now always returns a string.

This commit is contained in:
Valentin 2018-03-10 22:15:45 +03:00
parent e0f79f69be
commit 743692c3fd
3 changed files with 4 additions and 2 deletions

View File

@ -65,6 +65,7 @@ Security
* Using the `AdvancedUserInterface` is now deprecated. To use the existing
functionality, create a custom user-checker based on the
`Symfony\Component\Security\Core\User\UserChecker`.
* `AuthenticationUtils::getLastUsername()` now always returns a string.
SecurityBundle
--------------

View File

@ -9,6 +9,7 @@ CHANGELOG
* Using the AdvancedUserInterface is now deprecated. To use the existing
functionality, create a custom user-checker based on the
`Symfony\Component\Security\Core\User\UserChecker`.
* `AuthenticationUtils::getLastUsername()` now always returns a string.
4.0.0
-----

View File

@ -62,12 +62,12 @@ class AuthenticationUtils
$request = $this->getRequest();
if ($request->attributes->has(Security::LAST_USERNAME)) {
return $request->attributes->get(Security::LAST_USERNAME);
return $request->attributes->get(Security::LAST_USERNAME, '');
}
$session = $request->getSession();
return null === $session ? '' : $session->get(Security::LAST_USERNAME);
return null === $session ? '' : $session->get(Security::LAST_USERNAME, '');
}
/**