* 1.11.1 (2012-XX-XX)
+ * fixed escaping when calling a macro inside another one (regression introduced in 1.9.1)
* optimized variable access on PHP 5.4
* fixed a crash of the C extension when an exception was thrown from a macro called without being imported (using _self.XXX)
->write("throw \$e;\n")
->outdent()
->write("}\n\n")
- ->write("return ob_get_clean();\n")
+ ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());\n")
->outdent()
->write("}\n\n")
;
--- /dev/null
+--TEST--
+macro
+--TEMPLATE--
+{% import _self as macros %}
+
+{% macro foo(data) %}
+ {{ data }}
+{% endmacro %}
+
+{% macro bar() %}
+ <br />
+{% endmacro %}
+
+{{ macros.foo(macros.bar()) }}
+--DATA--
+return array();
+--EXPECT--
+<br />
throw \$e;
}
- return ob_get_clean();
+ return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());
}
EOF
),