aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/template')
-rw-r--r--phpBB/phpbb/template/twig/environment.php17
1 files changed, 16 insertions, 1 deletions
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);