summaryrefslogtreecommitdiff
path: root/libs/sysplugins/smarty_internal_compile_extends.php
diff options
context:
space:
mode:
authoruwe.tews@googlemail.com <uwe.tews@googlemail.com>2010-10-13 20:26:12 +0000
committeruwe.tews@googlemail.com <uwe.tews@googlemail.com>2010-10-13 20:26:12 +0000
commitcf42bcd242e87b0e57cd8dab16f263059156018a (patch)
tree3dd461ca3ca01f9851711bddd1a595d46f4cacb6 /libs/sysplugins/smarty_internal_compile_extends.php
parent7ec3cb453c8ca8af29683a84f8d4651c180de016 (diff)
downloadsmarty-cf42bcd242e87b0e57cd8dab16f263059156018a.tar.gz
smarty-cf42bcd242e87b0e57cd8dab16f263059156018a.tar.bz2
smarty-cf42bcd242e87b0e57cd8dab16f263059156018a.zip
- bugfix on template inheritance using nested eval or string resource in {extends} tags
Diffstat (limited to 'libs/sysplugins/smarty_internal_compile_extends.php')
-rw-r--r--libs/sysplugins/smarty_internal_compile_extends.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/sysplugins/smarty_internal_compile_extends.php b/libs/sysplugins/smarty_internal_compile_extends.php
index 37ebf7fd..bdb9debf 100644
--- a/libs/sysplugins/smarty_internal_compile_extends.php
+++ b/libs/sysplugins/smarty_internal_compile_extends.php
@@ -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');