mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
handle Throwable
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user