- bugfix implement replacement code for _tag_stack property https://github.com/smarty-php/smarty/issues/151

This commit is contained in:
uwetews
2016-01-29 01:21:00 +01:00
parent addd2a74e2
commit e1bf16a504
3 changed files with 11 additions and 4 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.30-dev ===== (xx.xx.xx)  ===== 3.1.30-dev ===== (xx.xx.xx)
29.01.2016
- bugfix implement replacement code for _tag_stack property https://github.com/smarty-php/smarty/issues/151
28.01.2016 28.01.2016
- bugfix allow windows network filepath or wrapper (forum topic 25876) https://github.com/smarty-php/smarty/issues/170 - bugfix allow windows network filepath or wrapper (forum topic 25876) https://github.com/smarty-php/smarty/issues/170
- bugfix if fetch('foo.tpl') is called on a template object the $parent parameter should default to the calling template object https://github.com/smarty-php/smarty/issues/152 - bugfix if fetch('foo.tpl') is called on a template object the $parent parameter should default to the calling template object https://github.com/smarty-php/smarty/issues/152

View File

@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.30-dev/27'; const SMARTY_VERSION = '3.1.30-dev/28';
/** /**
* define variable scopes * define variable scopes
@@ -1319,10 +1319,11 @@ class Smarty extends Smarty_Internal_TemplateBase
*/ */
public function __get($name) public function __get($name)
{ {
if (isset($this->accessMap[ $name ])) { if (isset($this->accessMap[ $name ])) {
$method = 'get' . $this->accessMap[ $name ]; $method = 'get' . $this->accessMap[ $name ];
return $this->{$method}(); return $this->{$method}();
} elseif (isset($this->_cache[ $name ])) {
return $this->_cache[ $name ];
} elseif (in_array($name, $this->obsoleteProperties)) { } elseif (in_array($name, $this->obsoleteProperties)) {
return null; return null;
} else { } else {

View File

@@ -65,12 +65,13 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
if (isset($callable)) { if (isset($callable)) {
$output .= "if (!is_callable({$callable})) {\nthrow new SmartyException('block tag \'{$tag}\' not callable or registered');\n}\n"; $output .= "if (!is_callable({$callable})) {\nthrow new SmartyException('block tag \'{$tag}\' not callable or registered');\n}\n";
} }
$output .= "\$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('{$tag}', {$_params});\n";
$output .= $output .=
"\$_block_repeat{$this->nesting}=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat{$this->nesting});\nwhile (\$_block_repeat{$this->nesting}) {\nob_start();\n?>"; "\$_block_repeat{$this->nesting}=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat{$this->nesting});\nwhile (\$_block_repeat{$this->nesting}) {\nob_start();\n?>";
$this->openTag($compiler, $tag, array($_params, $compiler->nocache, $callback)); $this->openTag($compiler, $tag, array($_params, $compiler->nocache, $callback));
// maybe nocache because of nocache variables or nocache plugin // maybe nocache because of nocache variables or nocache plugin
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache; $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
} else { } else {
// must endblock be nocache? // must endblock be nocache?
if ($compiler->nocache) { if ($compiler->nocache) {
$compiler->tag_nocache = true; $compiler->tag_nocache = true;
@@ -93,7 +94,9 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
} }
$output = "<?php " . $mod_content . "\$_block_repeat{$this->nesting}=false;\n" . $mod_pre . $output = "<?php " . $mod_content . "\$_block_repeat{$this->nesting}=false;\n" . $mod_pre .
"echo {$callback}({$_params}, " . $mod_content2 . "echo {$callback}({$_params}, " . $mod_content2 .
", \$_smarty_tpl, \$_block_repeat{$this->nesting});\n" . $mod_post . "}\n?>"; ", \$_smarty_tpl, \$_block_repeat{$this->nesting});\n" . $mod_post . "}\n";
$output .= "array_pop(\$_smarty_tpl->smarty->_cache['_tag_stack']);";
$output .= "?>";
$this->nesting --; $this->nesting --;
} }
return $output . "\n"; return $output . "\n";