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.5] Fixed null remember token error on EloquentUserProvider #21328

Merged
merged 1 commit into from
Sep 22, 2017

Conversation

Naxon
Copy link
Contributor

@Naxon Naxon commented Sep 22, 2017

I added a check that $model->getRememberToken() isn't null before comparing it to $token using hash_equals so it doesn't throw an error.

@Kyslik
Copy link
Contributor

Kyslik commented Sep 22, 2017

Related (merged) PR #21323
Related (closed) PR #21322

@Kyslik
Copy link
Contributor

Kyslik commented Sep 22, 2017

@Naxon I am just referencing another PR, with no intention to really comment on this PR. In other hand, It would be great if you could come up with failing test.

I think issue with that file is spread across 3 releases already (just unfortunate file!).

@taylorotwell
Copy link
Member

Are we actually even testing what is happening here? Has anyone actually run this code? /cc @mcordingley ...

Or are we just throwing crap against the wall and hoping it sticks?

@Naxon
Copy link
Contributor Author

Naxon commented Sep 22, 2017

@taylorotwell I ran the one I committed to check if it works, unfortunately no unit test.

@taylorotwell taylorotwell merged commit 0b03f4b into laravel:5.5 Sep 22, 2017
@mcordingley
Copy link
Contributor

Sorry. 😢 I ran the tests and everything passed just fine. I should have double-checked them to ensure that null would be handled, too.

@@ -64,7 +64,9 @@ public function retrieveByToken($identifier, $token)

$model = $model->where($model->getAuthIdentifierName(), $identifier)->first();

return $model && hash_equals($model->getRememberToken(), $token) ? $model : null;
$rememberToken = $model->getRememberToken();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Naxon What if $model == null here? There is a null-check for it two lines below, therefore I'm asking...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review makes sense. Why use $model to get rememberToken then right after it, check if the $model is null?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #21368.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #21368.

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.

6 participants