Bug 'In' rule validation when validating string with numeric values #54564
Replies: 4 comments
-
The validation is done using It might be best to create a custom rule for this purpose. |
Beta Was this translation helpful? Give feedback.
-
I think it will better if this rule make |
Beta Was this translation helpful? Give feedback.
-
That can easily broken existing applications if the rule is currently defined not to be strict. |
Beta Was this translation helpful? Give feedback.
-
Strict will break when int is sent and '1' is expected because of the explode by comma that is applied on the rule. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
11.3.4
PHP Version
8.3.15
Database Driver & Version
No response
Description
I need rules to validate string value with identical numeric value like
001
. I putRule::in(['001', '002'])
on my application. When testing with value like01
,1
or add multiple 0 as suffix it will be passed. It should break the validation and returning error response.Steps To Reproduce
routes/api.php
tests/ExampleTest.php
The
should fails validation
is returning 200 instead 422 and the second test there's no problem.Beta Was this translation helpful? Give feedback.
All reactions