diff --git a/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php b/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php index 8683aa2297936..33f39d5a365f9 100644 --- a/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php +++ b/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php @@ -38,7 +38,7 @@ public function isAnonymous(TokenInterface $token = null/*, $deprecation = true* trigger_deprecation('symfony/security-core', '5.4', 'The "%s()" method is deprecated, use "isAuthenticated()" or "isFullFledged()" if you want to check if the request is (fully) authenticated.', __METHOD__); } - return $token && !$this->isAuthenticated($token); + return $token instanceof AnonymousToken || ($token && !$token->getUser()); } /**