From 7aa67572e86d167bcbc51dcda33c3073eae1af32 Mon Sep 17 00:00:00 2001 From: Paulo Roberto Ribeiro Date: Thu, 1 Dec 2011 18:41:28 -0200 Subject: [PATCH] Bug correction: Parsing integers large than PHP_INT_MAX was generating trucated token values. --- lib/Twig/Lexer.php | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Twig/Lexer.php b/lib/Twig/Lexer.php index 7e62eac..007e7a1 100644 --- a/lib/Twig/Lexer.php +++ b/lib/Twig/Lexer.php @@ -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); -- 1.7.2.5