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/3608'
Browse files Browse the repository at this point in the history
Close #3608
  • Loading branch information
weierophinney committed Feb 5, 2013
2 parents 8dcaa6c + c41f7fe commit c629f8d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions library/Zend/InputFilter/BaseInputFilter.php
Expand Up @@ -166,6 +166,7 @@ public function isValid()
|| (is_array($this->data[$name])
&& isset($this->data[$name]['error']) && $this->data[$name]['error'] === UPLOAD_ERR_NO_FILE)
|| (is_array($this->data[$name]) && count($this->data[$name]) === 1
&& isset($this->data[$name][0]) && is_array($this->data[$name][0])
&& isset($this->data[$name][0]['error']) && $this->data[$name][0]['error'] === UPLOAD_ERR_NO_FILE)
) {
if ($input instanceof InputInterface) {
Expand Down
32 changes: 32 additions & 0 deletions tests/ZendTest/InputFilter/BaseInputFilterTest.php
Expand Up @@ -610,4 +610,36 @@ public function testGetUknown()
$unknown = $filter->getUnknown();
$this->assertEquals(0, count($unknown));
}

public function testValidateUseExplodeAndInstanceOf()
{
$filter = new InputFilter();

$input = new Input();
$input->setRequired(true);

$input->getValidatorChain()->attach(
new \Zend\Validator\Explode(
array(
'validator' => new \Zend\Validator\IsInstanceOf(
array(
'className' => 'Zend\InputFilter\Input'
)
)
)
)
);

$filter->add($input, 'example');

$data = array(
'example' => array(
$input
)
);

$filter->setData($data);
$this->assertTrue($filter->isValid());

}
}

0 comments on commit c629f8d

Please sign in to comment.