Skip to content

Commit

Permalink
Merge pull request #2 from gheckenbach/feature/php-7.4
Browse files Browse the repository at this point in the history
Don't try to parse floats as strings
  • Loading branch information
garthmz authored Sep 25, 2020
2 parents 2bb59f1 + 04f7e1e commit d0ae2ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/MockRedis.php
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ public function spop($key, $count=null) {
} else {
$count = self::ParseInt($count);
$result = [];
for ($i = 0; $i < $count && count($set); $i++) {
for ($i = 0; $i < $count && count($set); $i++) {
$result[] = array_pop($set);
}
return $result;
Expand Down Expand Up @@ -2511,6 +2511,9 @@ private static function ParseFloat($value, $name='value') {
} elseif ($value === '-inf') {
return -INF;
}
if (is_int($value) || is_float($value)) {
return (float)$value;
}
if (!is_numeric($value) || $value[0] == ' ') {
throw self::ErrorReply("ERR $name is not a valid float or out of range");
}
Expand Down

0 comments on commit d0ae2ca

Please sign in to comment.