Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Dec 3, 2021

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Dec 2, 2021

Q A
Branch? 5.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Complete diff of this PR must be removed when upmerging to 6.0.

@@ -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.');
Copy link
Member Author

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']);
}
Copy link
Member Author

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);
}
Copy link
Member Author

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.

@fabpot
Copy link
Member

fabpot commented Dec 3, 2021

Thank you @wouterj.

@fabpot fabpot merged commit 3fe93d6 into symfony:5.3 Dec 3, 2021
@wouterj wouterj deleted the fix-high-deps branch December 3, 2021 07:57
This was referenced Dec 9, 2021
@fabpot fabpot mentioned this pull request Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants