Skip to content

Commit

Permalink
Fixed case where $value isn't an array/Countable
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed May 24, 2019
1 parent 6e36565 commit b148d04
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/validators/ArrayValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,10 @@ public function init()
protected function validateValue($value)
{
if (!$value instanceof \Countable && !is_array($value)) {
$this->addError($model, $attribute, $this->message);

return;
return [$this->message, []];
}

$count = count((array)$value);
$count = count($value);

if ($this->min !== null && $count < $this->min) {
return [$this->tooFew, ['min' => $this->min]];
Expand Down

0 comments on commit b148d04

Please sign in to comment.