Skip to content

Commit

Permalink
bug #40758 [Security] NullToken signature (jderusse)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.2 branch.

Discussion
----------

[Security] NullToken signature

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

The signature of `TokenInterface::getUser` does not allow returning null. But `NullToken` returns `null`.
https://github.com/symfony/symfony/blob/0f96ac74847d114c9d9679655bcf3e94b6ba69d1/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php#L49-L56

This PR update `NullToken::getUser` to return an empty string instead of null.
I wonder if the fix shouldn't be to change the return type in the interface, but that would be a BC break, right?

Commits
-------

9ad3720efc [security] NullToken signature
  • Loading branch information
chalasr committed May 9, 2021
2 parents bc9e604 + 3db3098 commit f885ecd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Authentication/Token/NullToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getCredentials()

public function getUser()
{
return null;
return '';
}

public function setUser($user)
Expand Down

0 comments on commit f885ecd

Please sign in to comment.