Prechádzať zdrojové kódy

When route_attributes is null an exception is raised.

jeff 14 rokov pred
rodič
commit
52ec8752d8

+ 9 - 2
src/Symfony/Bundle/TwigBundle/Node/RouteNode.php

@@ -35,8 +35,15 @@ class RouteNode extends \Twig_Node
             ->write('echo $this->env->getExtension(\'templating\')->getContainer()->get(\'router\')->generate(')
             ->subcompile($this->getNode('route'))
             ->raw(', ')
-            ->subcompile($this->getNode('route_attributes'))
-            ->raw(', ')
+        ;
+
+        $attr = $this->getNode('route_attributes');
+        if ($attr) {
+            $compiler->subcompile($attr);
+        } else {
+            $compiler->raw('array()');
+        }
+        $compiler->raw(', ')
             ->raw($this->getAttribute('absolute') ? 'true' : 'false')
             ->raw(");")
         ;