From a33fb6ce2cc8ef2ea275460016e7dc90b8c8dedf Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 9 Jan 2017 17:10:34 +0100 Subject: [PATCH] Delay marking the environment as initialized until it is done --- lib/Twig/Environment.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index f13f1b73a..36b8d98b6 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -1439,7 +1439,6 @@ class Twig_Environment return; } - $this->extensionInitialized = true; $this->parsers = new Twig_TokenParserBroker(array(), array(), false); $this->filters = array(); $this->functions = array(); @@ -1452,6 +1451,8 @@ class Twig_Environment $this->initExtension($extension); } $this->initExtension($this->staging); + // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception + $this->extensionInitialized = true; } /**