Skip to content
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

[5.3] Fix Auth::onceUsingId by reversing the order of retrieving the id in SessionGuard #16373

Merged
merged 1 commit into from
Nov 12, 2016
Merged

Conversation

pdewit
Copy link
Contributor

@pdewit pdewit commented Nov 11, 2016

I was using Auth::onceUsingId() in one of my middleware, and when implementing this I noticed that Auth::id() and Auth::user()->id didn't return the same id anymore. Auth::id() was returning the ID of the user that was logged in before calling Auth::onceUsingId(), while Auth::user() returned the new logged in user.

This pull requests reverses the order in which the id is retrieved, so that the overridden user will always be returned if it has one, otherwise it looks at the current session. This fixes the issue explained above.

@taylorotwell taylorotwell merged commit 0b1c548 into laravel:5.3 Nov 12, 2016
@pdewit pdewit deleted the fix-onceusingid branch November 13, 2016 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants