From e91b1fa464c01d2ebf9fc9c732e8d2810223bc00 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 25 Jan 2016 00:31:13 +0100 Subject: [PATCH] =?UTF-8?q?[ticket/13717]=C2=A0Fix=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PHPBB3-13717 --- phpBB/phpbb/template/twig/environment.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index 709505a75f..5660ddc3a4 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -205,8 +205,23 @@ class environment extends \Twig_Environment */ public function display($name, array $context = []) { + $level = ob_get_level(); ob_start(); - parent::display($name, $context); + + try + { + parent::display($name, $context); + } + catch (\Exception $e) + { + while (ob_get_level() > $level) + { + ob_end_clean(); + } + + throw $e; + } + $output = ob_get_clean(); echo $this->inject_assets($output);