- bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23

This commit is contained in:
Uwe Tews
2015-05-05 03:33:53 +02:00
parent 6575e11f68
commit 3e4734acfb
3 changed files with 30 additions and 2 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.22-dev ===== (xx.xx.2015)  ===== 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 04.05.2015
- bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22) - 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) - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (https://github.com/smarty-php/smarty/issues/24)

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.22-dev/23'; const SMARTY_VERSION = '3.1.22-dev/24';
/** /**
* define variable scopes * define variable scopes

View File

@@ -408,7 +408,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
/** /**
* Compile Tag * Compile Tag
* This is a call back from the lexer/parser * 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 string $tag tag name
* @param array $args array with tag attributes * @param array $args array with tag attributes
@@ -420,6 +424,27 @@ abstract class Smarty_Internal_TemplateCompilerBase
*/ */
public function compileTag($tag, $args, $parameter = array()) 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 // $args contains the attributes parsed and compiled by the lexer/parser
// assume that tag does compile into code, but creates no HTML output // assume that tag does compile into code, but creates no HTML output
$this->has_code = true; $this->has_code = true;