Skip to content
Permalink
Browse files

bug #2345 Delay marking the environment as initialized until it is do…

…ne (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: symfony/symfony#21212
It would report the initialization error instead.

Commits
-------

a33fb6c Delay marking the environment as initialized until it is done
  • Loading branch information...
fabpot committed Jan 9, 2017
2 parents 94acd37 + a33fb6c commit d192cdce8cfdd1135a76c1c132ba2303c2b6fb60
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/Twig/Environment.php
@@ -1439,7 +1439,6 @@ protected function initExtensions()
return;
}
$this->extensionInitialized = true;
$this->parsers = new Twig_TokenParserBroker(array(), array(), false);
$this->filters = array();
$this->functions = array();
@@ -1452,6 +1451,8 @@ protected function initExtensions()
$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;
}
/**

0 comments on commit d192cdc

Please sign in to comment.
You can’t perform that action at this time.