Commit fb7cb1b6 authored by Jeremy Mikola's avatar Jeremy Mikola

Older servers may return count "n" as a float

parent c5a0964f
......@@ -91,11 +91,12 @@ class Count implements Executable
throw new RuntimeException(isset($result['errmsg']) ? $result['errmsg'] : 'Unknown error');
}
if ( ! isset($result['n']) || ! is_integer($result['n'])) {
throw new UnexpectedValueException('count command did not return an "n" integer');
// Older server versions may return a float
if ( ! isset($result['n']) || ! (is_integer($result['n']) || is_float($result['n']))) {
throw new UnexpectedValueException('count command did not return an "n" value');
}
return $result['n'];
return (integer) $result['n'];
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment