From 352c01a078ae4942cabbd9624f7a90400214fe6b Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 23 Jan 2017 22:13:37 +0100 Subject: [PATCH] Remove legacy exception catches from 2.x --- lib/Twig/Extension/Core.php | 6 ------ lib/Twig/Template.php | 6 ------ lib/Twig/TemplateWrapper.php | 6 ------ test/Twig/Tests/Extension/SandboxTest.php | 1 - 4 files changed, 19 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index dd503eca4..e5ee86ce3 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -1269,12 +1269,6 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a $sandbox->disableSandbox(); } - throw $e; - } catch (Exception $e) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - throw $e; } diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index b635967a5..46e6b3c0f 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -370,12 +370,6 @@ abstract class Twig_Template ob_start(); try { $this->display($context); - } catch (Exception $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; } catch (Throwable $e) { while (ob_get_level() > $level) { ob_end_clean(); diff --git a/lib/Twig/TemplateWrapper.php b/lib/Twig/TemplateWrapper.php index b72b92c20..f7388f364 100644 --- a/lib/Twig/TemplateWrapper.php +++ b/lib/Twig/TemplateWrapper.php @@ -93,12 +93,6 @@ final class Twig_TemplateWrapper ob_start(); try { $this->template->displayBlock($name, $context); - } catch (Exception $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; } catch (Throwable $e) { while (ob_get_level() > $level) { ob_end_clean(); diff --git a/test/Twig/Tests/Extension/SandboxTest.php b/test/Twig/Tests/Extension/SandboxTest.php index 0b2158269..6bed83795 100644 --- a/test/Twig/Tests/Extension/SandboxTest.php +++ b/test/Twig/Tests/Extension/SandboxTest.php @@ -250,7 +250,6 @@ EOF try { $twig->loadTemplate('1_include')->render(self::$params); } catch (Throwable $e) { - } catch (Exception $e) { } if ($e === null) { $this->fail('An exception should be thrown for this test to be valid.');