diff --git a/change_log.txt b/change_log.txt index 2773e0a0..a87d4383 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@  ===== 3.1.22-dev ===== (xx.xx.2015) + 05.05.2015 + - bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23 + 04.05.2015 - bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22) - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (https://github.com/smarty-php/smarty/issues/24) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index dff28d21..bb1d658f 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.22-dev/23'; + const SMARTY_VERSION = '3.1.22-dev/24'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 025ac8e5..091e6428 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -408,7 +408,11 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Compile Tag * This is a call back from the lexer/parser - * It executes the required compile plugin for the Smarty tag + * + * Save current prefix code + * Compile tag + * Merge tag prefix code with saved one + * (required nested tags in attributes) * * @param string $tag tag name * @param array $args array with tag attributes @@ -420,6 +424,27 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function compileTag($tag, $args, $parameter = array()) { + $this->prefixCodeStack[] = $this->prefix_code; + $this->prefix_code = array(); + $result = $this->compileTag2($tag, $args, $parameter); + $this->prefix_code = array_merge($this->prefix_code, array_pop($this->prefixCodeStack)); + return $result; + } + + /** + * Compile Tag + * + * @param string $tag tag name + * @param array $args array with tag attributes + * @param array $parameter array with compilation parameter + * + * @throws SmartyCompilerException + * @throws SmartyException + * @return string compiled code + */ + private function compileTag2($tag, $args, $parameter) + { + $plugin_type = ''; // $args contains the attributes parsed and compiled by the lexer/parser // assume that tag does compile into code, but creates no HTML output $this->has_code = true;