-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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.4] ConvertEmptyStringsToNull middleware is causing problems in validation #17663
Comments
What is the validation error you are getting? |
@lioannou
|
Same problem here using "required_with":
With password field empty I have a error in repeat_password: The repeat password and password must match. Removing the middleware ConvertEmptyStringsToNull works as expected. |
What happens when you use "nullable"? |
Adding
PS - Such changes should be documented somewhere. |
Here's a blog post describing the issue http://themsaid.com/laravel-convert-empty-strings-to-null-20170130/ I'm not sure if it should be in the docs though, maybe the upgrade guide :) Please feel free to PR the docs to add a hint about that if you want. |
@themsaid I add to my validation nullable, but nw I get many issues with saving the data. Does ConvertEmptyStringsToNull convert my value to "null" also for storing the data, or just for the validation session? |
It converts empty request parameters to null, so yeah it'll hit the database as null. The middleware is not mandatory, you can comment it and get back to the 5.3 behaviour easily. |
Description:
I upgrade my project from 5.3 to 5.4, everything worked fine.
Now i am facing issues when an input field is optional and submitted as empty string.
Steps To Reproduce:
Lets have a validation request class with rules like -
This field is optional, when we submit the form without typing anything into text field it should pass the validation. But it not.
If we comment out
ConvertEmptyStringsToNull
middleware it passes the validation.This is not related to
numeric
validation. It applies to all type of validations for egalpha
FYI: I have those two new middlewares in
Kernal.php
.The text was updated successfully, but these errors were encountered: