Skip to content

Commit

Permalink
Removed problematic float filter from a utility method
Browse files Browse the repository at this point in the history
  • Loading branch information
milos-pejanovic-devtech committed Nov 23, 2016
1 parent 25f0147 commit d9bbe52
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/Common/Util/Iteration.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public static function typeFilter($source) {
else {
$source = Validation::filterInteger($source);
$source = Validation::filterBoolean($source);
$source = Validation::filterFloat($source);
}

return $source;
Expand Down
3 changes: 2 additions & 1 deletion src/Common/Util/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit d9bbe52

Please sign in to comment.