Skip to content

Commit

Permalink
Check for an empty string early
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <george@net-glue.co.uk>
  • Loading branch information
gsteel committed Nov 7, 2023
1 parent f4db049 commit c42d9e5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Validator/IsFloat.php
Original file line number Diff line number Diff line change
@@ -118,6 +118,12 @@ public function isValid($value)
return true;
}

if ($value === '') {
$this->error(self::NOT_FLOAT);

return false;
}

// Need to check if this is scientific formatted string. If not, switch to decimal.
$formatter = new NumberFormatter($this->getLocale(), NumberFormatter::SCIENTIFIC);

0 comments on commit c42d9e5

Please sign in to comment.