Improve array of bools filtering

This commit is contained in:
Matias Griese
2020-01-08 16:03:26 +02:00
parent 1c2c38545a
commit eca3896bfc
3 changed files with 9 additions and 1 deletions

View File

@@ -126,3 +126,4 @@ form:
ignore_empty: true
validate:
type: array
value_type: bool

View File

@@ -45,3 +45,4 @@ form:
ignore_empty: true
validate:
type: array
value_type: bool

View File

@@ -720,7 +720,13 @@ class Validation
if ($type && $val !== '' && $val !== null) {
switch ($type) {
case 'bool':
$val = Utils::isPositive($val);
if (Utils::isPositive($val)) {
$val = true;
} elseif (Utils::isNegative($val)) {
$val = false;
} else {
$val = null;
}
break;
case 'int':
$val = (int)$val;