projects
/
web/konrad/twig.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
9a638a4
)
Bug correction: Parsing integers large than PHP_INT_MAX was generating trucated token...
author
Paulo Roberto Ribeiro
<paulo@duocriativa.com.br>
Thu, 1 Dec 2011 19:54:23 +0000 (17:54 -0200)
committer
Paulo Roberto Ribeiro
<paulo@duocriativa.com.br>
Thu, 1 Dec 2011 19:54:23 +0000 (17:54 -0200)
lib/Twig/Lexer.php
patch
|
blob
|
history
diff --git
a/lib/Twig/Lexer.php
b/lib/Twig/Lexer.php
index
6c75d45
..
7e62eac
100644
(file)
--- a/
lib/Twig/Lexer.php
+++ b/
lib/Twig/Lexer.php
@@
-221,7
+221,13
@@
class Twig_Lexer implements Twig_LexerInterface
}
// numbers
elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) {
- $this->pushToken(Twig_Token::NUMBER_TYPE, ctype_digit($match[0]) ? (int) $match[0] : (float) $match[0]);
+ $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);
$this->moveCursor($match[0]);
}
// punctuation