From d9bbe52dac075eb87e9f2cc177437a642dc6b761 Mon Sep 17 00:00:00 2001 From: milos-pejanovic-devtech Date: Wed, 23 Nov 2016 15:47:05 +0100 Subject: [PATCH] Removed problematic float filter from a utility method --- src/Common/Util/Iteration.php | 1 - src/Common/Util/Validation.php | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Common/Util/Iteration.php b/src/Common/Util/Iteration.php index 5777dbf..b1597d0 100644 --- a/src/Common/Util/Iteration.php +++ b/src/Common/Util/Iteration.php @@ -76,7 +76,6 @@ public static function typeFilter($source) { else { $source = Validation::filterInteger($source); $source = Validation::filterBoolean($source); - $source = Validation::filterFloat($source); } return $source; diff --git a/src/Common/Util/Validation.php b/src/Common/Util/Validation.php index da6ea58..f6c4f8a 100644 --- a/src/Common/Util/Validation.php +++ b/src/Common/Util/Validation.php @@ -98,12 +98,13 @@ public static function filterBoolean($value) { /** * Returns a casted float or the original value + * This one isnt reliable, dont use * @param mixed $value * @return float|mixed */ public static function filterFloat($value) { $floatValue = filter_var($value, FILTER_VALIDATE_FLOAT); - if($floatValue !== false && is_string($value)) { + if($floatValue !== false && is_string($value) && preg_match('[.|,]', $value)) { $value = $floatValue; }