Skip to content

Commit

Permalink
cast "true"/"false" to bool
Browse files Browse the repository at this point in the history
  • Loading branch information
thorewi committed Nov 17, 2024
1 parent 9c288cc commit 18fef47
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Application/UI/ParameterConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ private static function castScalar(mixed &$val, string $type): bool
return false;
}

if ($type === 'bool') {
if ($val === 'true') {
$val = true;
return true;
} elseif ($val === 'false') {
$val = false;
return true;
}
}

$tmp = ($val === false ? '0' : (string) $val);
if ($type === 'float') {
$tmp = preg_replace('#\.0*$#D', '', $tmp);
Expand Down

0 comments on commit 18fef47

Please sign in to comment.