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

Commit 9382925

Browse files
committed
Fix patch do not touch type spec in Inputs
1 parent 93e2f27 commit 9382925

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Factory.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,17 @@ public function createInputFilter($inputFilterSpecification)
341341
} else {
342342

343343
// Patch to enable nested, integer indexed input_filter_specs
344-
// InputFilter doesn't have an name property!
345-
// But if the key is an integer and type and name are specified maybe we could use it.
346-
if (isset($value['type']) && is_string($value['type'])) {
347-
if (isset($value['name']) && is_string($value['name'])) {
344+
// Check type and name are in spec
345+
if (isset($value['type']) && is_string($value['type'])
346+
&& isset($value['name']) && is_string($value['name'])) {
347+
// Make sure type is an InputFilter
348+
$checkType = $this->getInputFilterManager()->get($value['type']);
349+
if ($checkType instanceof InputFilter) {
350+
// Only apply when key is an integer
348351
if (is_integer($key)) {
349352
$key = $value['name'];
350353
}
351-
// Remove
354+
// Remove name from spec. InputFilter doesn't have an name property!
352355
unset($value['name']);
353356
}
354357
}

0 commit comments

Comments
 (0)