Skip to content

Commit 0a6a38c

Browse files
Merge branch '4.4' into 5.0
* 4.4: (27 commits) [Serializer] minor cleanup fix merge Run PHP 8 as 7.4.99 Remove calls to deprecated ReflectionParameter::getClass(). [VarDumper] fix PHP 8 support Add php 8 to travis. [Cache] Accessing undefined constants raises an Error in php8 [Cache] allow DBAL v3 Skip Doctrine DBAL on php 8 until we have a compatible version. [DomCrawler] Catch expected ValueError. Made method signatures compatible with their corresponding traits. [ErrorHandler] Apply php8 fixes from Debug component. [DomCrawler] Catch expected ValueError. [Validator] Catch expected ValueError. [VarDumper] ReflectionFunction::isDisabled() is deprecated. [BrowserKit] Raw body with custom Content-Type header [PropertyAccess] Parse php 8 TypeErrors correctly. [Intl] Fix call to ReflectionProperty::getValue() for static properties. [HttpKernel] Prevent calling method_exists() with non-string values. Fix wrong roles comparison ...
2 parents b407dd4 + 0581f4d commit 0a6a38c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Authentication/Token/AbstractToken.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,10 @@ private function hasUserChanged(UserInterface $user): bool
270270
return true;
271271
}
272272

273+
$currentUserRoles = array_map('strval', (array) $this->user->getRoles());
273274
$userRoles = array_map('strval', (array) $user->getRoles());
274275

275-
if ($this instanceof SwitchUserToken) {
276-
$userRoles[] = 'ROLE_PREVIOUS_ADMIN';
277-
}
278-
279-
if (\count($userRoles) !== \count($this->getRoleNames()) || \count($userRoles) !== \count(array_intersect($userRoles, $this->getRoleNames()))) {
276+
if (\count($userRoles) !== \count($currentUserRoles) || \count($userRoles) !== \count(array_intersect($userRoles, $currentUserRoles))) {
280277
return true;
281278
}
282279

Tests/Authentication/Token/AbstractTokenTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function getUserChanges()
152152
*/
153153
public function testSetUserDoesNotSetAuthenticatedToFalseWhenUserDoesNotChange($user)
154154
{
155-
$token = new ConcreteToken();
155+
$token = new ConcreteToken(['ROLE_FOO']);
156156
$token->setAuthenticated(true);
157157
$this->assertTrue($token->isAuthenticated());
158158

0 commit comments

Comments
 (0)