feature #13401 [TwigBundle] use the new Twig autoescaping strategy (fabpot)
This PR was merged into the 2.7 branch.
Discussion
----------
[TwigBundle] use the new Twig autoescaping strategy
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
55c4b41
[TwigBundle] use the new Twig autoescaping strategy
This commit is contained in:
commit
8d12652162
|
@ -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": {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated since version 2.7, will be removed in 3.0. Use the "filename" auto-escaping strategy instead.
|
||||
*/
|
||||
class TwigDefaultEscapingStrategy
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in New Issue