- 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 use caching properties of template instead of smarty object when compiling child {block}
- bugfix {*block}...{/block*} did throw an exception in template inheritance
- bugfix on template inheritance using nested eval or string resource in {extends} tags
===== RC4 =====

View File

@@ -36,12 +36,16 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
// create template object
$_template = new $compiler->smarty->template_class($include_file, $this->smarty, $compiler->template);
// save file dependency
$template_sha1 = sha1($_template->getTemplateFilepath());
if (in_array($_template->resource_type,array('eval','string'))) {
$template_sha1 = sha1($include_file);
} else {
$template_sha1 = sha1($_template->getTemplateFilepath());
}
if (isset($compiler->template->properties['file_dependency'][$template_sha1])) {
$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());
$_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) !=
preg_match_all("!({$this->_ldl}/block{$this->_rdl})!", $_content, $c)) {
$this->compiler->trigger_template_error('unmatched {block} {/block} pairs');