Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/6494'
Browse files Browse the repository at this point in the history
Fixes #6494
  • Loading branch information
weierophinney committed Aug 7, 2014
2 parents ce45124 + 51793f8 commit f83dec7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions library/Zend/InputFilter/CollectionInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ public function isValid()
}
}

if (count($this->data) < $this->getCount()) {
if (is_scalar($this->data)
|| count($this->data) < $this->getCount()
) {
$valid = false;
}

if (empty($this->data)) {
if (empty($this->data) || is_scalar($this->data)) {
$this->clearValues();
$this->clearRawValues();

Expand Down
10 changes: 10 additions & 0 deletions tests/ZendTest/InputFilter/CollectionInputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,4 +771,14 @@ public function testNestingCollectionCountCached($count, $expectedIsValid)
$mainInputFilter->setData($data);
$this->assertSame($expectedIsValid, $mainInputFilter->isValid());
}

public function testInvalidCollectionIsNotValid()
{
$data = 1;

$this->filter->setInputFilter($this->getBaseInputFilter());
$this->filter->setData($data);

$this->assertFalse($this->filter->isValid());
}
}

0 comments on commit f83dec7

Please sign in to comment.