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.8] Fix FormRequest validate not twice. #26486

Merged
merged 1 commit into from Nov 12, 2018

Conversation

ttsuru
Copy link
Contributor

@ttsuru ttsuru commented Nov 12, 2018

Add tests to #26419
Fix validate method.

refs #25736

@@ -172,7 +181,7 @@ protected function failedAuthorization()
*/
public function validated()
{
return $this->getValidatorInstance()->validated();
return $this->validator->validated();
Copy link
Member

Choose a reason for hiding this comment

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

What if you call this method before the validator is set? I think we should think this through more.

Copy link
Contributor Author

@ttsuru ttsuru Nov 12, 2018

Choose a reason for hiding this comment

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

@driesvints
Thanks for checking.
ValidatesWhenResolvedTrait::validateResolved() is called in FormRequestServiceProvider::boot() afterResolving.

So I think that it is normally set.

Choose a reason for hiding this comment

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

can't this be fixed by adding a simple if statement that can be added to the getValidatorInstance?

Copy link
Contributor Author

@ttsuru ttsuru Nov 12, 2018

Choose a reason for hiding this comment

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

@mohammedmanssour
I think so too, but getValidatorInstance called twice.
We require single validator instance.

@taylorotwell taylorotwell merged commit 835f112 into laravel:master Nov 12, 2018
@ttsuru ttsuru changed the title [5.8] Fix FormRequest validate not twlice. [5.8] Fix FormRequest validate not twice. Nov 15, 2018
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

4 participants