From: Fabien Potencier Date: Sat, 3 Dec 2011 07:16:26 +0000 (+0100) Subject: fixed macros containing filter tag calls X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=c6917a28ef7fdd23aef161a814491342db1d1199;p=web%2Fkonrad%2Ftwig.git fixed macros containing filter tag calls --- diff --git a/CHANGELOG b/CHANGELOG index 14ce2c2..40d6281 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +* 1.4.0 + + * fixed macros containing filter tag calls + * 1.4.0-RC2 (2011-11-27) * removed usage of Reflection in Twig_Template::getAttribute() diff --git a/lib/Twig/Node/Macro.php b/lib/Twig/Node/Macro.php index be74726..5db1bf1 100644 --- a/lib/Twig/Node/Macro.php +++ b/lib/Twig/Node/Macro.php @@ -64,6 +64,7 @@ class Twig_Node_Macro extends Twig_Node } $compiler + ->write("\$blocks = array();\n\n") ->write("ob_start();\n") ->write("try {\n") ->indent() diff --git a/test/Twig/Tests/Fixtures/macros/with_filters.test b/test/Twig/Tests/Fixtures/macros/with_filters.test new file mode 100644 index 0000000..685626f --- /dev/null +++ b/test/Twig/Tests/Fixtures/macros/with_filters.test @@ -0,0 +1,14 @@ +--TEST-- +macro with a filter +--TEMPLATE-- +{% import _self as test %} + +{% macro test() %} + {% filter escape %}foo
{% endfilter %} +{% endmacro %} + +{{ test.test() }} +--DATA-- +return array(); +--EXPECT-- +foo<br /> diff --git a/test/Twig/Tests/Node/MacroTest.php b/test/Twig/Tests/Node/MacroTest.php index 66d5fec..ddb67d1 100644 --- a/test/Twig/Tests/Node/MacroTest.php +++ b/test/Twig/Tests/Node/MacroTest.php @@ -50,6 +50,8 @@ public function getfoo(\$foo = null) "foo" => \$foo, )); + \$blocks = array(); + ob_start(); try { echo "foo";