Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions library/Zend/InputFilter/BaseInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@ protected function populate()
continue;
}

if ($input instanceof ArrayInput) {
$input->setValue(array());
continue;
}

$input->setValue(null);
continue;
}
Expand Down
16 changes: 16 additions & 0 deletions tests/ZendTest/InputFilter/BaseInputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,4 +860,20 @@ public function testIsValidWhenValuesSetOnFilters()
$this->assertTrue($filter->get('foo')->isValid(), 'Filtered value is not valid');
$this->assertTrue($filter->isValid(), 'Input filter did return value from filter');
}

/**
* @group 5638
*/
public function testPopulateSupportsArrayInputEvenIfDataMissing()
{
$arrayInput = $this->getMock('Zend\InputFilter\ArrayInput');
$arrayInput
->expects($this->once())
->method('setValue')
->with(array());

$filter = new InputFilter();
$filter->add($arrayInput, 'arrayInput');
$filter->setData(array('foo' => 'bar'));
}
}