From d0ad3df670e0b9b1367b3c8329df94099a6832a6 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Sun, 19 Feb 2012 15:48:05 +0000 Subject: [PATCH] - bugfix {include} could result in a fatal error if used in appended or prepended nested {block} tags (reported by mh and Issue 83) --- change_log.txt | 4 ++++ libs/sysplugins/smarty_internal_compile_block.php | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/change_log.txt b/change_log.txt index da976b92..1824fc48 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,8 @@ ===== trunk ===== +19.02.2012 +- bugfix {include} could result in a fatal error if used in appended or prepended nested {block} tags + (reported by mh and Issue 83) + 07.02.2012 - bugfix increase entropy of internal function names in compiled and cached template files (Forum Topic 20996) - enhancement cacheable parameter added to default plugin handler, same functionality as in registerPlugin (request by calguy1000) diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index 1cfc0f0c..d40c3577 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -240,10 +240,14 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { $_name = trim($saved_data[0]['name'], "\"'"); if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) { // restore to status before {block} tag as new subtemplate code of parent {block} is not needed - $compiler->merged_templates = $saved_data[4]; - $compiler->smarty->merged_templates_func = $saved_data[5]; - $compiler->template->properties = $saved_data[6]; - $compiler->template->has_nocache_code = $saved_data[7]; + // TODO: Below code was disabled in 3.1.8 because of problems with {include} in nested {block} tags in child templates + // combined with append/prepend or $smarty.block.parent + // For later versions it should be checked under which conditions it could run for optimisation + // + //$compiler->merged_templates = $saved_data[4]; + //$compiler->smarty->merged_templates_func = $saved_data[5]; + //$compiler->template->properties = $saved_data[6]; + //$compiler->template->has_nocache_code = $saved_data[7]; $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name); } else { if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) { @@ -256,7 +260,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { // reset flags $compiler->parser->current_buffer = $saved_data[1]; $compiler->nocache = $saved_data[2]; - $compiler->smarty->merge_compiled_includes = $saved_data[3]; + //$compiler->smarty->merge_compiled_includes = $saved_data[3]; // reset flag for {block} tag $compiler->inheritance = false; // $_output content has already nocache code processed