mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 02:46:29 +00:00
fixed output when a macro throws an exception
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
Changes:
|
||||
|
||||
* fixed output when a macro throws an exception
|
||||
* fixed a parsing problem when a large chunk of text is enclosed in a comment tag
|
||||
|
||||
* 1.1.1 (2011-07-17)
|
||||
|
||||
@@ -55,8 +55,16 @@ class Twig_Node_Macro extends Twig_Node
|
||||
->outdent()
|
||||
->write("));\n\n")
|
||||
->write("ob_start();\n")
|
||||
->write("try {\n")
|
||||
->indent()
|
||||
->subcompile($this->getNode('body'))
|
||||
->raw("\n")
|
||||
->outdent()
|
||||
->write("} catch(Exception \$e) {\n")
|
||||
->indent()
|
||||
->write("ob_end_clean();\n\n")
|
||||
->write("throw \$e;\n")
|
||||
->outdent()
|
||||
->write("}\n\n")
|
||||
->write("return ob_get_clean();\n")
|
||||
->outdent()
|
||||
->write("}\n\n")
|
||||
|
||||
@@ -51,7 +51,13 @@ public function getfoo(\$foo = null)
|
||||
));
|
||||
|
||||
ob_start();
|
||||
echo "foo";
|
||||
try {
|
||||
echo "foo";
|
||||
} catch(Exception \$e) {
|
||||
ob_end_clean();
|
||||
|
||||
throw \$e;
|
||||
}
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user