Skip to content

Commit

Permalink
- bugfix code could be messed up when {tags} are used in multiple att…
Browse files Browse the repository at this point in the history
…ributes #23
  • Loading branch information
uwetews committed May 5, 2015
1 parent 6575e11 commit 3e4734a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 26 additions & 1 deletion libs/sysplugins/smarty_internal_templatecompilerbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,11 @@ public function compileTemplate(Smarty_Internal_Template $template, $nocache = n
/**
* 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
Expand All @@ -420,6 +424,27 @@ public function compileTemplate(Smarty_Internal_Template $template, $nocache = n
*/
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;
Expand Down

0 comments on commit 3e4734a

Please sign in to comment.