mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Fixes invalid argument to foreach
happens when you have a rule looking for sub items in arrays, but actually pass in a scalar value bombs out with invalid argument to foreach
This commit is contained in:
parent
15171779b3
commit
e8ab4dc157
@ -889,6 +889,11 @@ class Validator
|
||||
if (is_array($identifiers) && count($identifiers) === 0) {
|
||||
return array($data, false);
|
||||
}
|
||||
|
||||
// Catches the case where the data isn't an array or object
|
||||
if (is_scalar($data)) {
|
||||
return array($data, false);
|
||||
}
|
||||
|
||||
$identifier = array_shift($identifiers);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user