Skip to content

Commit

Permalink
Fixed: #94
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammaye committed Jul 1, 2013
1 parent 0270525 commit 88cce6e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions EMongoCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,15 @@ public function compare($column, $value = null, $strong = false) {
if (preg_match('/^(?:\s*(<>|<=|>=|<|>|=))?(.*)$/', $value, $matches)) {
$value = $matches[2];
$op = $matches[1];
if (!$strong && !preg_match('/^([0-9]|[1-9]{1}\d+)$/', $value))
if (!$strong)
$value = new MongoRegex("/$value/i");
else {
if (preg_match('/^([0-9]|[1-9]{1}\d+)$/', $value))
$value = (int) $value;
if(
!is_bool($value) && !is_array($value) && preg_match('/^([0-9]|[1-9]{1}\d+)$/' /* Will only match real integers, unsigned */, $value) > 0
&& ( (PHP_INT_MAX > 2147483647 && (string)$value < '9223372036854775807') /* If it is a 64 bit system and the value is under the long max */
|| (string)$value < '2147483647' /* value is under 32bit limit */)
)
$value=(int)$value;
}

switch($op){
Expand Down

0 comments on commit 88cce6e

Please sign in to comment.