Commit f0656e0b authored by Haralan Dobrev's avatar Haralan Dobrev

Replace twig.options defaults every time

Fixes https://github.com/silexphp/Silex/issues/1577
parent bc50a7e6
......@@ -51,14 +51,6 @@ class TwigServiceProvider implements ServiceProviderInterface
$app['twig.number_format.thousands_separator'] = ',';
$app['twig'] = function ($app) {
$app['twig.options'] = array_replace(
[
'charset' => $app['charset'],
'debug' => $app['debug'],
'strict_variables' => $app['debug'],
], $app['twig.options']
);
$twig = $app['twig.environment_factory']($app);
// registered for BC, but should not be used anymore
// deprecated and should probably be removed in Silex 3.0
......@@ -172,7 +164,11 @@ class TwigServiceProvider implements ServiceProviderInterface
};
$app['twig.environment_factory'] = $app->protect(function ($app) {
return new \Twig_Environment($app['twig.loader'], $app['twig.options']);
return new \Twig_Environment($app['twig.loader'], array_replace([
'charset' => $app['charset'],
'debug' => $app['debug'],
'strict_variables' => $app['debug'],
], $app['twig.options']));
});
$app['twig.runtime.httpkernel'] = function ($app) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment