Browse Source

[TwigBundle] Fixed RenderTokenParser when with isn't used and options are provided

Jordi Boggiano 14 years ago
parent
commit
252918beb2
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/Symfony/Bundle/TwigBundle/TokenParser/RenderTokenParser.php

+ 4 - 2
src/Symfony/Bundle/TwigBundle/TokenParser/RenderTokenParser.php

@@ -14,7 +14,7 @@ namespace Symfony\Bundle\TwigBundle\TokenParser;
 use Symfony\Bundle\TwigBundle\Node\RenderNode;
 
 /**
- * 
+ *
  *
  * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  */
@@ -35,13 +35,15 @@ class RenderTokenParser extends \Twig_TokenParser
         if ($this->parser->getStream()->test(\Twig_Token::NAME_TYPE, 'with')) {
             $this->parser->getStream()->next();
 
+            $hasAttributes = true;
             $attributes = $this->parser->getExpressionParser()->parseExpression();
         } else {
+            $hasAttributes = false;
             $attributes = new \Twig_Node_Expression_Array(array(), $token->getLine());
         }
 
         // options
-        if ($this->parser->getStream()->test(\Twig_Token::PUNCTUATION_TYPE, ',')) {
+        if ($hasAttributes && $this->parser->getStream()->test(\Twig_Token::PUNCTUATION_TYPE, ',')) {
             $this->parser->getStream()->next();
 
             $options = $this->parser->getExpressionParser()->parseExpression();