bug #2345 Delay marking the environment as initialized until it is done (stof)

This PR was merged into the 1.x branch.

Discussion
----------

Delay marking the environment as initialized until it is done

This avoids breaking the symfony exception page rendering saying that filters are not available due to a partial initialization: https://github.com/symfony/symfony/issues/21212
It would report the initialization error instead.

Commits
-------

a33fb6ce Delay marking the environment as initialized until it is done
This commit is contained in:
Fabien Potencier
2017-01-09 12:28:52 -08:00
+2 -1
View File
@@ -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;
}
/**