bug #2040 handle Throwable (fprochazka)

This PR was merged into the 1.x branch.

Discussion
----------

handle Throwable

Related #2041

Commits
-------

99e9d1c handle Throwable
This commit is contained in:
Fabien Potencier
2016-05-30 11:04:21 +02:00
4 changed files with 19 additions and 0 deletions
+4
View File
@@ -438,6 +438,10 @@ class Twig_Environment
} catch (Exception $e) {
$this->setLoader($current);
throw $e;
} catch (Throwable $e) {
$this->setLoader($current);
throw $e;
}
$this->setLoader($current);
+5
View File
@@ -109,6 +109,11 @@ class Twig_Node_Macro extends Twig_Node
->write("ob_end_clean();\n\n")
->write("throw \$e;\n")
->outdent()
->write("} catch (Throwable \$e) {\n")
->indent()
->write("ob_end_clean();\n\n")
->write("throw \$e;\n")
->outdent()
->write("}\n\n")
->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());\n")
->outdent()
+6
View File
@@ -369,6 +369,12 @@ abstract class Twig_Template implements Twig_TemplateInterface
ob_end_clean();
}
throw $e;
} catch (Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
+4
View File
@@ -58,6 +58,10 @@ public function getfoo(\$__foo__ = null, \$__bar__ = "Foo"$declaration)
} catch (Exception \$e) {
ob_end_clean();
throw \$e;
} catch (Throwable \$e) {
ob_end_clean();
throw \$e;
}