From 20970419b4e2b9e9235682d4ccb52e1c16185dbc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 14 Dec 2010 16:23:56 +0100 Subject: [PATCH] removed support for foo.% which does not make sense --- lib/Twig/ExpressionParser.php | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/lib/Twig/ExpressionParser.php b/lib/Twig/ExpressionParser.php index 5522941..323c420 100644 --- a/lib/Twig/ExpressionParser.php +++ b/lib/Twig/ExpressionParser.php @@ -235,7 +235,13 @@ class Twig_ExpressionParser $type = Twig_Node_Expression_GetAttr::TYPE_ANY; if ($token->getValue() == '.') { $token = $this->parser->getStream()->next(); - if ($token->getType() == Twig_Token::NAME_TYPE || $token->getType() == Twig_Token::NUMBER_TYPE || $token->getType() == Twig_Token::OPERATOR_TYPE) { + if ( + $token->getType() == Twig_Token::NAME_TYPE + || + $token->getType() == Twig_Token::NUMBER_TYPE + || + ($token->getType() == Twig_Token::OPERATOR_TYPE && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue())) + ) { $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno); if ($this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '(')) { -- 1.7.2.5