diff --git a/Smarty.class.php b/Smarty.class.php index ff74d081..2f44189e 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -709,6 +709,7 @@ class Smarty [=] /x', $tag_args, $match); $tokens = $match[0]; + $var_delims = array('$', '#', '%'); $attrs = array(); /* Parse state: @@ -755,7 +756,7 @@ class Smarty /* If the token is not variable (doesn't start with '$', '#', or '%') and not enclosed in single or double quotes we single-quote it. */ - else if (!in_array($token{0}, array('$', '#', '%')) && + else if (!in_array($token{0}, $var_delims) && !(($token{0} == '"' || $token[0] == "'") && $token{strlen($token)-1} == $token{0})) $token = "'".$token."'"; diff --git a/demo/templates/index.tpl b/demo/templates/index.tpl index 762f54d9..d5c8749d 100644 --- a/demo/templates/index.tpl +++ b/demo/templates/index.tpl @@ -18,4 +18,4 @@ My interests are: none {/section} -{html_options values=$LastName output=$FirstName|replace:"a":"@"} +{html_options values=#title# output=$FirstName|replace:"a":"@"} diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index ff74d081..2f44189e 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -709,6 +709,7 @@ class Smarty [=] /x', $tag_args, $match); $tokens = $match[0]; + $var_delims = array('$', '#', '%'); $attrs = array(); /* Parse state: @@ -755,7 +756,7 @@ class Smarty /* If the token is not variable (doesn't start with '$', '#', or '%') and not enclosed in single or double quotes we single-quote it. */ - else if (!in_array($token{0}, array('$', '#', '%')) && + else if (!in_array($token{0}, $var_delims) && !(($token{0} == '"' || $token[0] == "'") && $token{strlen($token)-1} == $token{0})) $token = "'".$token."'"; diff --git a/templates/index.tpl b/templates/index.tpl index 762f54d9..d5c8749d 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -18,4 +18,4 @@ My interests are: none {/section} -{html_options values=$LastName output=$FirstName|replace:"a":"@"} +{html_options values=#title# output=$FirstName|replace:"a":"@"}