Wixel / GUMP

A fast, extensible & stand-alone PHP input validation class that allows you to validate any data
https://wixelhq.com
MIT License
1.17k stars 341 forks source link

Required validator does not apply to array type inputs #308

Closed hslimen closed 4 years ago

hslimen commented 4 years ago
private function foreach_call_validator(string $rule, string $field, array $input, array $rule_params = [])
{
    $values = !is_array($input[$field]) ? [ $input[$field] ] : $input[$field];

    foreach ($values as $value) {
        $result = $this->call_validator($rule, $field, $input, $rule_params, $value);
        if (is_array($result)) {
            return $result;
        }
    }

    return true;
}

can that solve the problem ?

    $values = !is_array($input[$field]) ? [ $input[$field] ] : [$field => $input[$field]];
filisko commented 4 years ago

what are your filters and what is your input? $filters / $data