From 048fd5e274454573020bc87b92a7af94e56d3113 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Thu, 10 Dec 2009 17:23:32 +0000 Subject: [PATCH] - bugfix on {function} tags and template inheritance --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_compile_block.php | 14 +++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/change_log.txt b/change_log.txt index 99649e9e..fcbc02c5 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +12/10/2009 +- bugfix on {function} tags and template inheritance + 12/05/2009 - fixed problem when a cached file was fetched several times - removed unneeded lexer code diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index ee2802f1..41a775c1 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -66,6 +66,8 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { $_tpl = $this->smarty->createTemplate('string:' . $this->smarty->block_data[$_name]['source'], null, null, $compiler->template); $_tpl->template_filepath = $this->smarty->block_data[$_name]['file']; $_tpl->forceNocache = true; + $_tpl->suppressHeader = true; + $_tpl->suppressFileDependency = true; if (strpos($this->smarty->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) { $_output = str_replace('%%%%SMARTY_PARENT%%%%', $compiler->template->extracted_compiled_code, $_tpl->getCompiledTemplate()); @@ -75,20 +77,14 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { $_output = $compiler->template->extracted_compiled_code . $_tpl->getCompiledTemplate(); } elseif (!empty($this->smarty->block_data[$_name])) { $_output = $_tpl->getCompiledTemplate(); - } - unset($tpl); + } + $compiler->template->properties = array_merge_recursive($compiler->template->properties, $_tpl->properties); + unset($_tpl); } else { $_output = $compiler->template->extracted_compiled_code; } $compiler->template->extracted_compiled_code = $saved_data[1]; $compiler->template->extract_code = $saved_data[2]; - // check for includes in block tags - preg_match('/(\<\?php \$_smarty_tpl-\>decodeProperties\(\')(.*)(\'.*\?\>)/', $_output, $matches); - $_output = preg_replace(array('/(\<\?php \$_smarty_tpl-\>decodeProperties\(\')(.*)(\'.*\?\>.*\n)/', '/(\<\?php if\(\!defined\(\'SMARTY_DIR\'\)\))(.*)(\?\>.*\n)/'), '', $_output); - if (isset($matches[2])) { - $prop = unserialize($matches[2]); - $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $prop['file_dependency']); - } return $_output; } }