When validating an array with a custom validation Rule, the $value param of the rule's passes() method receives the array with dot placeholders included in keys. This makes it impossible to validate array keys containing dots.
Related to #33357
Send a request with an array query parameter that has keys containing dots e.g. foo[foo.bar]=baz
Validate with a custom validation rule e.g. ['foo' => new CustomRule()]
dd() the $value param of the passes() method and the result will be something like: ['fooP0gffDX4ilGw68H6bar' => 'baz']
I don't believe we allow dots in input variables during validation because dots have special meaning with array depth validation in Laravel.
Ping @themsaid
I don't believe we allow dots in input variables during validation because dots have special meaning with array depth validation in Laravel.
This worked just fine prior to version 7 with the -> replacement. I realise this was probably undocumented functionality but we found it really useful for creating APIs with relational filters e.g. filter[posts.category.id][is]=5
Fixed in upcoming patch release.
@taylorotwell is this being patched in v7 also?
@BenWalters https://github.com/laravel/framework/pull/34355
Issue is still actual for 6.x
@taylorotwell will fix be ported there too ?