-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Fix compatibility with symfony/security-core 6.x (deps=high tests) #44427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
be80f95
to
e044b17
Compare
@@ -148,6 +153,11 @@ public function testGetUser() | |||
|
|||
public function testGetUserAnonymousUserConvertedToNull() | |||
{ | |||
// @deprecated since Symfony 5.4 | |||
if (!class_exists(AnonymousToken::class)) { | |||
$this->markTestSkipped('This test requires "symfony/security-core" <6.0.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is irrelevant in 6.0, as anonymous tokens are removed and anonymous sessions are now null anyways (so no conversion is needed in AbstractController::getUser()
).
$token = new UsernamePasswordToken($user, 'pass', 'default', ['ROLE_USER']); | ||
} else { | ||
$token = new UsernamePasswordToken($user, 'default', ['ROLE_USER']); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected BC break, correct deprecations are triggered on 5.4.
// @deprecated since Symfony 5.4 | ||
if (method_exists($token, 'setAuthenticated')) { | ||
$token->setAuthenticated(true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The real bugfix of this PR, this adds support for security-core 6.0 in FrameworkBundle.
Thank you @wouterj. |
Complete diff of this PR must be removed when upmerging to 6.0.