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

Commit 3b9d3ef

Browse files
committed
Merge branch 'hotfix/15'
Close #15
2 parents bb78ee1 + 2b70102 commit 3b9d3ef

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5+
## 2.5.4 - 2015-08-11
6+
7+
### Added
8+
9+
- Nothing.
10+
11+
### Deprecated
12+
13+
- Nothing.
14+
15+
### Removed
16+
17+
- Nothing.
18+
19+
### Fixed
20+
21+
- [#15](https://github.com/zendframework/zend-inputfilter/pull/15) ensures that
22+
`ArrayAccess` data provided to an input filter using `setData()` can be
23+
validated, a scenario that broke with [#7](https://github.com/zendframework/zend-inputfilter/pull/7).
24+
525
## 2.5.3 - 2015-08-03
626

727
### Added
@@ -49,6 +69,26 @@ All notable changes to this project will be documented in this file, in reverse
4969
(previously, it would consider the data set valid, and auto-initialize the
5070
missing input to `null`).
5171

72+
## 2.4.7 - 2015-08-11
73+
74+
### Added
75+
76+
- Nothing.
77+
78+
### Deprecated
79+
80+
- Nothing.
81+
82+
### Removed
83+
84+
- Nothing.
85+
86+
### Fixed
87+
88+
- [#15](https://github.com/zendframework/zend-inputfilter/pull/15) ensures that
89+
`ArrayAccess` data provided to an input filter using `setData()` can be
90+
validated, a scenario that broke with [#7](https://github.com/zendframework/zend-inputfilter/pull/7).
91+
5292
## 2.4.6 - 2015-08-03
5393

5494
### Added

src/BaseInputFilter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ public function isValid($context = null)
224224
/**
225225
* Validate a set of inputs against the current data
226226
*
227-
* @param array $inputs
228-
* @param array $data
227+
* @param array $inputs
228+
* @param array|ArrayAccess $data
229229
* @param mixed|null $context
230230
* @return bool
231231
*/
232-
protected function validateInputs(array $inputs, array $data = [], $context = null)
232+
protected function validateInputs(array $inputs, $data = [], $context = null)
233233
{
234234
// backwards compatibility
235235
if (empty($data)) {

test/BaseInputFilterTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ZendTest\InputFilter;
1111

12+
use ArrayObject;
1213
use PHPUnit_Framework_TestCase as TestCase;
1314
use stdClass;
1415
use Zend\InputFilter\Input;
@@ -1096,4 +1097,21 @@ public function testEmptyRequiredValueWithFallbackShouldMarkInputValid()
10961097
$this->assertArrayHasKey('bar', $data);
10971098
$this->assertEquals($bar->getFallbackValue(), $data['bar']);
10981099
}
1100+
1101+
/**
1102+
* @group 15
1103+
*/
1104+
public function testAllowsValidatingArrayAccessData()
1105+
{
1106+
$filter = new InputFilter();
1107+
$foo = new Input();
1108+
$foo->getFilterChain()->attachByName('stringtrim')
1109+
->attachByName('alpha');
1110+
$foo->getValidatorChain()->attach(new Validator\StringLength(3, 6));
1111+
$filter->add($foo, 'foo');
1112+
1113+
$data = new ArrayObject(['foo' => ' valid ']);
1114+
$filter->setData($data);
1115+
$this->assertTrue($filter->isValid());
1116+
}
10991117
}

0 commit comments

Comments
 (0)