-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
$token->getUser() should return null instead of empty string when there is no user #44909
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
Comments
Can you create a small example application that allows to reproduce your issue? |
Hi, @xabbuh . I was able to take a look at the source. Putting Checking it's implementation I see it returns an empty string instead of Could you confirm? Or do you still need an example? |
OK, never mind. Looking at the v But the 5.4 wasn't? I thought, 5.4 still receives bug fixes or am I wrong? |
Hi, @xabbuh . Was this enough information? |
I used it like so:
|
See #45697 |
…lasr) This PR was merged into the 5.4 branch. Discussion ---------- [Security] Fix return value of `NullToken::getUser()` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #44909 | License | MIT | Doc PR | - We went back & forth on this one but according to the history, we've just forgot to do it in #42650. Note: it's already `null` on 6.0+ Commits ------- d892a51 Fix return value of `NullToken::getUser()`
Symfony version(s) affected
5.4.*
Description
When using voters and accessing the user through
TokenInterface
and there is no user logged in, the function returns an empty string''
instead ofnull
. Failing a strict comparison testnull === $user
.How to reproduce
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: