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:
Elizabeth M Smith 2017-06-23 14:01:34 -04:00 committed by GitHub
parent 15171779b3
commit e8ab4dc157

View File

@ -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);