diff --git a/change_log.txt b/change_log.txt index a7d5c8e9..b4fb593a 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +05.04.2013 +- bugfix post filter must not run when compiling inheritance child blocks (Forum Topic 24094) + 28.02.2013 - bugfix nocache blocks could be lost when using CACHING_LIFETIME_SAVED (Issue #133) - bugfix Compile ID gets nulled when compiling child blocks (Issue #134) @@ -11,7 +14,7 @@ - enhancement allow to disable exception message escaping by SmartyException::$escape = false; (Issue #130) 09.01.2013 -- bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) +- bugfix compilation did fail when a prefilter did modify an {extends} tag c - bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127) - bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128) - added abstract method declaration doCompile() in Smarty_Internal_TemplateCompilerBase (Forum Topic 23969) diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index 14537037..9fa6685a 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -190,6 +190,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { $_tpl->compiler->forceNocache = 1; } $_tpl->compiler->suppressHeader = true; + $_tpl->compiler->suppressFilter = true; $_tpl->compiler->suppressTemplatePropertyHeader = true; $_tpl->compiler->suppressMergedTemplates = true; if (strpos($compiler->template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) { diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index bc536750..373824ac 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -106,6 +106,12 @@ abstract class Smarty_Internal_TemplateCompilerBase { */ public $suppressTemplatePropertyHeader = false; + /** + * suppress pre and post filter + * @var bool + */ + public $suppressFilter = false; + /** * flag if compiled template file shall we written * @var bool @@ -184,7 +190,7 @@ abstract class Smarty_Internal_TemplateCompilerBase { // get template source $_content = $template->source->content; // run prefilter if required - if (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) { + if ((isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) && !$this->suppressFilter) { $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template); } // on empty template just return header @@ -209,13 +215,9 @@ abstract class Smarty_Internal_TemplateCompilerBase { foreach ($this->merged_templates as $code) { $merged_code .= $code; } - // run postfilter if required on merged code - if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) { - $merged_code = Smarty_Internal_Filter_Handler::runFilter('post', $merged_code, $template); - } } // run postfilter if required on compiled template code - if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) { + if ((isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) && !$this->suppressFilter) { $_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template); } if ($this->suppressTemplatePropertyHeader) {