From: Fabien Potencier Date: Fri, 7 Dec 2012 15:09:05 +0000 (+0100) Subject: added an exception when misusing macro calls (refs #922) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=3ca17acb4aaf6add233390741d3ac5198a98d602;p=web%2Fkonrad%2Ftwig.git added an exception when misusing macro calls (refs #922) --- diff --git a/lib/Twig/ExpressionParser.php b/lib/Twig/ExpressionParser.php index 6a555e1..dc49c49 100644 --- a/lib/Twig/ExpressionParser.php +++ b/lib/Twig/ExpressionParser.php @@ -393,6 +393,10 @@ class Twig_ExpressionParser } if ($node instanceof Twig_Node_Expression_Name && null !== $alias = $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { + if (!$arg instanceof Twig_Node_Expression_Constant) { + throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s")', $node->getAttribute('name')), $token->getLine(), $this->parser->getFilename()); + } + $node = new Twig_Node_Expression_MethodCall($node, 'get'.$arg->getAttribute('value'), $arguments, $lineno); $node->setAttribute('safe', true);