Bug correction: Parsing integers large than PHP_INT_MAX was generating trucated token...
authorPaulo Roberto Ribeiro <paulo@duocriativa.com.br>
Thu, 1 Dec 2011 20:41:28 +0000 (18:41 -0200)
committerPaulo Roberto Ribeiro <paulo@duocriativa.com.br>
Thu, 1 Dec 2011 20:41:28 +0000 (18:41 -0200)
lib/Twig/Lexer.php

index 7e62eac..007e7a1 100644 (file)
@@ -221,10 +221,10 @@ class Twig_Lexer implements Twig_LexerInterface
         }
         // numbers
         elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) {
-            $number = (float)$match[0];  // floats
-            if(ctype_digit($match[0])) {
-                if($number<=PHP_INT_MAX) {
-                    $number = (int)$match[0]; // integers lower than the maximum
+            $number = (float) $match[0];  // floats
+            if (ctype_digit($match[0])) {
+                if ($number <= PHP_INT_MAX) {
+                    $number = (int) $match[0]; // integers lower than the maximum
                 }
             }
             $this->pushToken(Twig_Token::NUMBER_TYPE, $number);