-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix: Validation of fields with a leading asterisk. #6243
Fix: Validation of fields with a leading asterisk. #6243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not great with regex patterns but your test case looks good and nothing else failed so it's good by me. Thank you!
Original reporter verifies this works 💪 |
['foo' => null], | ||
]; | ||
|
||
$this->validation->setRules(['*.foo' => 'required'], ['1.foo' => ['required' => 'Required {field}']]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related with this bug, but ['1.foo' => ['required' => 'Required {field}']]
seems tricky .
I would like to write ['*.foo' => ['required' => 'Required {field}']]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, it turned out that the option you suggested does not work. The default error text is returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error text will be defined for the *.foo
field, and the 1.foo
field is passed.
Thank you! @iRedds |
Description
https://forum.codeigniter.com/showthread.php?tid=82391&pid=398147#pid398147
Fixed: Validation of fields with a leading asterisk (wildcard).
Also fixed getting an error by field name with a leading asterisk.
Checklist: