Delay marking the environment as initialized until it is done

This commit is contained in:
Christophe Coevoet
2017-01-09 17:10:34 +01:00
parent 94acd37011
commit a33fb6ce2c
+2 -1
View File
@@ -1439,7 +1439,6 @@ class Twig_Environment
return; return;
} }
$this->extensionInitialized = true;
$this->parsers = new Twig_TokenParserBroker(array(), array(), false); $this->parsers = new Twig_TokenParserBroker(array(), array(), false);
$this->filters = array(); $this->filters = array();
$this->functions = array(); $this->functions = array();
@@ -1452,6 +1451,8 @@ class Twig_Environment
$this->initExtension($extension); $this->initExtension($extension);
} }
$this->initExtension($this->staging); $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;
} }
/** /**