Skip to content

Commit

Permalink
fix: force string to number
Browse files Browse the repository at this point in the history
  • Loading branch information
papac committed Dec 26, 2020
1 parent 1b73f7c commit ef2079b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Security/Sanitize.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ public static function make($data, $secure = false)
$rNum = '/^[0-9]+(\.[0-9]+)?$/';

if (is_string($data)) {
if (! preg_match($rNum, $data, $match)) {
if (!preg_match($rNum, $data, $match)) {
return static::$method($data);
}

if (count($match) == 2) {
$data = (float) $data;
} else {
$data = (int) $data;
}

return $data;
}

Expand Down

0 comments on commit ef2079b

Please sign in to comment.