- bugfix on template inheritance using nested eval or string resource in {extends} tags

This commit is contained in:
uwe.tews@googlemail.com
2010-10-13 20:26:12 +00:00
parent 7ec3cb453c
commit cf42bcd242
2 changed files with 7 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
- bugfix removed ambiguity between ternary and stream variable in template syntax - bugfix removed ambiguity between ternary and stream variable in template syntax
- bugfix use caching properties of template instead of smarty object when compiling child {block} - bugfix use caching properties of template instead of smarty object when compiling child {block}
- bugfix {*block}...{/block*} did throw an exception in template inheritance - bugfix {*block}...{/block*} did throw an exception in template inheritance
- bugfix on template inheritance using nested eval or string resource in {extends} tags
===== RC4 ===== ===== RC4 =====

View File

@@ -36,12 +36,16 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
// create template object // create template object
$_template = new $compiler->smarty->template_class($include_file, $this->smarty, $compiler->template); $_template = new $compiler->smarty->template_class($include_file, $this->smarty, $compiler->template);
// save file dependency // save file dependency
if (in_array($_template->resource_type,array('eval','string'))) {
$template_sha1 = sha1($include_file);
} else {
$template_sha1 = sha1($_template->getTemplateFilepath()); $template_sha1 = sha1($_template->getTemplateFilepath());
}
if (isset($compiler->template->properties['file_dependency'][$template_sha1])) { if (isset($compiler->template->properties['file_dependency'][$template_sha1])) {
$this->compiler->trigger_template_error("illegal recursive call of \"{$include_file}\"",$compiler->lex->line-1); $this->compiler->trigger_template_error("illegal recursive call of \"{$include_file}\"",$compiler->lex->line-1);
} }
$compiler->template->properties['file_dependency'][$template_sha1] = array($_template->getTemplateFilepath(), $_template->getTemplateTimestamp()); $compiler->template->properties['file_dependency'][$template_sha1] = array($_template->getTemplateFilepath(), $_template->getTemplateTimestamp());
$_content = $compiler->template->template_source; $_content = substr($compiler->template->template_source,$compiler->lex->counter-1);
if (preg_match_all("!({$this->_ldl}block\s(.+?){$this->_rdl})!", $_content, $s) != if (preg_match_all("!({$this->_ldl}block\s(.+?){$this->_rdl})!", $_content, $s) !=
preg_match_all("!({$this->_ldl}/block{$this->_rdl})!", $_content, $c)) { preg_match_all("!({$this->_ldl}/block{$this->_rdl})!", $_content, $c)) {
$this->compiler->trigger_template_error('unmatched {block} {/block} pairs'); $this->compiler->trigger_template_error('unmatched {block} {/block} pairs');