You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Rule::when(...) inside a Rule::forEach(...) callback, an Object of class Illuminate\Validation\ConditionalRules could not be converted to string exception is thrown.
I suspect Illuminate\ValidationValidationRuleParser::prepareRule(...) does not deal with ConditionalRule.
I suspect it was an oversight of #40498.
If this is expected behavior, a mention in the docs might be warranted.
If I didn't understand something, please educate me.
I might try to make a failing test PR tomorrow, but I'm probably out of my depth to fix the actual bug itself.
Cheers, and thanks for the hard work.
Steps To Reproduce
Here is a minimum reproduction code in routes/web.php.
Laravel Version
v10.10.0
PHP Version
8.1.5
Database Driver & Version
No response
Description
When using
Rule::when(...)
inside aRule::forEach(...)
callback, anObject of class Illuminate\Validation\ConditionalRules could not be converted to string
exception is thrown.I suspect
Illuminate\ValidationValidationRuleParser::prepareRule(...)
does not deal withConditionalRule
.I suspect it was an oversight of #40498.
If this is expected behavior, a mention in the docs might be warranted.
If I didn't understand something, please educate me.
I might try to make a failing test PR tomorrow, but I'm probably out of my depth to fix the actual bug itself.
Cheers, and thanks for the hard work.
Steps To Reproduce
Here is a minimum reproduction code in
routes/web.php
.The text was updated successfully, but these errors were encountered: