diff --git a/src/Compile/PrintExpressionCompiler.php b/src/Compile/PrintExpressionCompiler.php
index 90837e67..e5cc2dbc 100644
--- a/src/Compile/PrintExpressionCompiler.php
+++ b/src/Compile/PrintExpressionCompiler.php
@@ -66,7 +66,6 @@ class PrintExpressionCompiler extends Base {
if (!$_attr['nofilter']) {
// default modifier
if ($compiler->smarty->getDefaultModifiers()) {
-
$modifierlist = [];
foreach ($compiler->smarty->getDefaultModifiers() as $key => $single_default_modifier) {
preg_match_all(
diff --git a/src/Compile/Tag/Setfilter.php b/src/Compile/Tag/Setfilter.php
index 703641db..c58d7322 100644
--- a/src/Compile/Tag/Setfilter.php
+++ b/src/Compile/Tag/Setfilter.php
@@ -20,8 +20,18 @@ class Setfilter extends Base {
* @return string compiled code
*/
public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
- $compiler->variable_filter_stack[] = $compiler->getSmarty()->getAutoModifiers();
- $compiler->getSmarty()->setAutoModifiers((array) $parameter['modifier_list']);
+ $compiler->variable_filter_stack[] = $compiler->getSmarty()->getDefaultModifiers();
+
+ // The modifier_list is passed as an array of array's. The inner arrays have the modifier at index 0,
+ // and, possibly, parameters at subsequent indexes, e.g. [ ['escape','"mail"'] ]
+ // We will collapse them so the syntax is OK for ::setDefaultModifiers() as follows: [ 'escape:"mail"' ]
+ $newList = [];
+ foreach($parameter['modifier_list'] as $modifier) {
+ $newList[] = implode(':', $modifier);
+ }
+
+ $compiler->getSmarty()->setDefaultModifiers($newList);
+
// this tag does not return compiled code
$compiler->has_code = false;
return true;
diff --git a/src/Compile/Tag/SetfilterClose.php b/src/Compile/Tag/SetfilterClose.php
index 9edac780..d666f59e 100644
--- a/src/Compile/Tag/SetfilterClose.php
+++ b/src/Compile/Tag/SetfilterClose.php
@@ -31,7 +31,7 @@ class SetfilterClose extends Base {
$this->getAttributes($compiler, $args);
// reset variable filter to previous state
- $compiler->getSmarty()->setAutoModifiers(
+ $compiler->getSmarty()->setDefaultModifiers(
count($compiler->variable_filter_stack) ? array_pop($compiler->variable_filter_stack) : []
);
diff --git a/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php b/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php
index e86f28fe..beea132a 100644
--- a/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php
@@ -33,14 +33,14 @@ class CompileSetfilterTest extends PHPUnit_Smarty
public function testNestedSetfilter()
{
$this->smarty->setCaching(1);
- $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter htmlspecialchars} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
+ $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter escape} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
$tpl->assign('foo', '');
$this->assertEquals(" <a@b.c><a@b.c> <a@b.c> ", $this->smarty->fetch($tpl));
}
public function testNestedSetfilter1()
{
$this->smarty->setCaching(1);
- $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter htmlspecialchars} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
+ $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter escape} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
$tpl->assign('foo', '');
$this->assertEquals(" <a@b.c><e@f.d> <a@b.c> ", $this->smarty->fetch($tpl));
}
@@ -50,7 +50,7 @@ class CompileSetfilterTest extends PHPUnit_Smarty
*/
public function testNestedSetfilter2()
{
- $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter htmlspecialchars} {$foo}{setfilter escape:"mail"} {$foo}{/setfilter} {$foo}{/setfilter} {$foo}');
+ $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter escape} {$foo}{setfilter escape:"mail"} {$foo}{/setfilter} {$foo}{/setfilter} {$foo}');
$tpl->assign('foo', '');
$this->assertEquals(" <a@b.c> <a@b.c> ", $this->smarty->fetch($tpl));
}