Change behavior of 'autoescape' filter to always escape (but not double-escape)

This commit is contained in:
Kijin Sung 2017-02-22 21:29:15 +09:00
parent 7fd0f5df7b
commit 5638207fb0
2 changed files with 12 additions and 3 deletions

View file

@ -315,9 +315,17 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
PHP_EOL . '$this->config->autoescape = \'on\';' . "\n" . 'echo ($this->config->autoescape === \'on\' ? htmlspecialchars($__Context->foo, ENT_COMPAT, \'UTF-8\', false) : $__Context->foo) ?>'
),
array(
'<config autoescape="off" />{$foo|autoescape}',
'<config autoescape="off" />{$foo|auto}',
PHP_EOL . '$this->config->autoescape = \'off\';' . "\n" . 'echo ($this->config->autoescape === \'on\' ? htmlspecialchars($__Context->foo, ENT_COMPAT, \'UTF-8\', false) : $__Context->foo) ?>'
),
array(
'<config autoescape="on" />{$foo|autoescape}',
PHP_EOL . '$this->config->autoescape = \'on\';' . "\n" . 'echo htmlspecialchars($__Context->foo, ENT_COMPAT, \'UTF-8\', false) ?>'
),
array(
'<config autoescape="off" />{$foo|autoescape}',
PHP_EOL . '$this->config->autoescape = \'off\';' . "\n" . 'echo htmlspecialchars($__Context->foo, ENT_COMPAT, \'UTF-8\', false) ?>'
),
array(
'<config autoescape="on" />{$foo|escape}',
PHP_EOL . '$this->config->autoescape = \'on\';' . "\n" . 'echo htmlspecialchars($__Context->foo, ENT_COMPAT, \'UTF-8\', true) ?>'