diff --git a/UPGRADE-4.1.md b/UPGRADE-4.1.md index d76e3a3796188..dd48fff35031b 100644 --- a/UPGRADE-4.1.md +++ b/UPGRADE-4.1.md @@ -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 -------------- diff --git a/src/Symfony/Component/Security/CHANGELOG.md b/src/Symfony/Component/Security/CHANGELOG.md index 717d525f0b0dd..ec33a7af97a4b 100644 --- a/src/Symfony/Component/Security/CHANGELOG.md +++ b/src/Symfony/Component/Security/CHANGELOG.md @@ -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 ----- diff --git a/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php b/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php index ba886373e969c..fbdc0bc5ebfd0 100644 --- a/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php +++ b/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php @@ -62,12 +62,12 @@ public function getLastUsername() $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, ''); } /**
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: