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

[11.x] MessageBag errors out when custom rules are created and the class is left out of the message array #52451

Merged
merged 5 commits into from
Aug 13, 2024

Conversation

DanteB918
Copy link
Contributor

@DanteB918 DanteB918 commented Aug 11, 2024

Issue

When an array of custom messages is passed into the Validator, and one of the rules is a custom validation rule, if that rule's class is not passed into the message array then all of the rules are exploded into the message bag.

This is happening because we aren't hitting the null coalesce here, and are returning the rest of the defined messages for the given key.

When the message is an array, but the rule isn't set, it should default to $rule->message() rather than the array of messages
@DanteB918 DanteB918 changed the title MessageBag errors out when custom rules are created and the class is left out of the message array [11.x] MessageBag errors out when custom rules are created and the class is left out of the message array Aug 12, 2024
@taylorotwell taylorotwell merged commit 2d899e2 into laravel:11.x Aug 13, 2024
29 checks passed
@DanteB918 DanteB918 deleted the custom-validation-issue-52437 branch August 14, 2024 02:01
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.

3 participants