Skip to content

Array to string conversion ErrorException #48187

Closed
@yooslim

Description

@yooslim

Laravel Version

10.4.1

PHP Version

8.1.2

Database Driver & Version

No response

Description

When using "RequiredIf" validation rule that is dependant on another boolean field, if the boolean field gets a non empty array as input, an ErrorException is thrown when trying to get the displayable value of the boolean field.

Steps To Reproduce

$validator = \Illuminate\Support\Facades\Validator::make([
    'is_customer' => ['test'],
    'fullname' => null
], [
    'is_customer' => 'required|boolean',
    'fullname' => 'required_if:is_customer,true'
]);
  
$validator->fails(); // <= ErrorException

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions