Handle negative numbers in Env::i & co.
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 21 Jun 2011 22:06:02 +0000 (00:06 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 21 Jun 2011 22:06:02 +0000 (00:06 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
include/misc.inc.php

index b60045d..edae818 100644 (file)
@@ -384,7 +384,7 @@ function ends_with($string, $suffix, $caseSensitive = true)
  */
 function can_convert_to_integer($data)
 {
-    return is_int($data) || ctype_digit($data);
+    return is_int($data) || ctype_digit($data) || ($data[0] == '-' && ctype_digit(substr($data, 1)));
 }
 
 /** Interpret the input data as an integer or return false.