diff --git a/composer.json b/composer.json index 91a097a12e..4642916eb4 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.9", "doctrine/common": "~2.3", - "twig/twig": "~1.12,>=1.12.3", + "twig/twig": "~1.17", "psr/log": "~1.0" }, "replace": { diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index cda147d5c2..803642831f 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.9", "symfony/security-csrf": "~2.6|~3.0.0", - "twig/twig": "~1.13,>=1.13.1" + "twig/twig": "~1.17" }, "require-dev": { "symfony/finder": "~2.3|~3.0.0", diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php index 4ac0847707..7aaa48d476 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -166,9 +166,7 @@ class Configuration implements ConfigurationInterface $rootNode ->fixXmlConfig('path') ->children() - ->variableNode('autoescape') - ->defaultValue(array('Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy', 'guess')) - ->end() + ->variableNode('autoescape')->defaultValue('filename')->end() ->scalarNode('autoescape_service')->defaultNull()->end() ->scalarNode('autoescape_service_method')->defaultNull()->end() ->scalarNode('base_template_class')->example('Twig_Template')->end() diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 9709059caf..c8dcf4e5d7 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -149,7 +149,7 @@ class TwigExtensionTest extends TestCase $this->compileContainer($container); $options = $container->getParameter('twig.options'); - $this->assertEquals(array('Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy', 'guess'), $options['autoescape']); + $this->assertEquals('filename', $options['autoescape']); } public function testGlobalsWithDifferentTypesAndValues() diff --git a/src/Symfony/Bundle/TwigBundle/TwigDefaultEscapingStrategy.php b/src/Symfony/Bundle/TwigBundle/TwigDefaultEscapingStrategy.php index d3a7fb026e..9c5a06069e 100644 --- a/src/Symfony/Bundle/TwigBundle/TwigDefaultEscapingStrategy.php +++ b/src/Symfony/Bundle/TwigBundle/TwigDefaultEscapingStrategy.php @@ -11,8 +11,12 @@ namespace Symfony\Bundle\TwigBundle; +trigger_error('The '.__NAMESPACE__.'\TwigDefaultEscapingStrategy class is deprecated in version 2.7 and will be removed in version 3.0. Use the "filename" auto-escaping strategy instead.', E_USER_DEPRECATED); + /** * @author Fabien Potencier + * + * @deprecated since version 2.7, will be removed in 3.0. Use the "filename" auto-escaping strategy instead. */ class TwigDefaultEscapingStrategy { diff --git a/src/Symfony/Bundle/TwigBundle/TwigEngine.php b/src/Symfony/Bundle/TwigBundle/TwigEngine.php index 9aeb630c47..35640505c0 100644 --- a/src/Symfony/Bundle/TwigBundle/TwigEngine.php +++ b/src/Symfony/Bundle/TwigBundle/TwigEngine.php @@ -54,13 +54,13 @@ class TwigEngine extends BaseEngine implements EngineInterface /** * @deprecated since version 2.7, to be removed in 3.0. - * Use TwigDefaultEscapingStrategy instead. + * Use the 'filename' strategy instead. */ public function guessDefaultEscapingStrategy($filename) { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy::guess method instead.', E_USER_DEPRECATED); + trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Use the Twig_FileExtensionEscapingStrategy::guess method instead.', E_USER_DEPRECATED); - return TwigDefaultEscapingStrategy::guess($filename); + return \Twig_FileExtensionEscapingStrategy::guess($filename); } /**