From 191a13b623a5b26d95addf295b6b7e5b84e8decb Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Fri, 14 Sep 2012 14:42:15 +0000 Subject: [PATCH] - bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_compile_block.php | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 0bb03e1b..8b5df253 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +14.09.2012 +- bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008) + 11.09.2012 - bugfix escape Smarty exception messages to avoid possible script execution diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index b1d94517..11a67998 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -101,17 +101,17 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { $replacement = ''; } // replace {$smarty.block.child} tag - $search = array("%({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})([\s\S]*?)({$_ldl}{$al}/block\s*{$_rdl})%", "/§§§child§§§/"); + $search = array("!({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})([\s\S]*?)({$_ldl}{$al}/block\s*{$_rdl})!", "/§§§child§§§/"); $replace = array('\2§§§child§§§\4', $replacement); $block_content = preg_replace($search, $replace, $block_content); } else { // remove hidden blocks - $block_content = preg_replace("%({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl}[\s\S]*?{$_ldl}{$al}/block\s*{$_rdl})%", '', $block_content); + $block_content = preg_replace("!({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl}[\s\S]*?{$_ldl}{$al}/block\s*{$_rdl})!", '', $block_content); } } } // do we have not nested {$smart.block.child} - if (0 != preg_match("/({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})/", $block_content, $_match2)) { + if (0 != preg_match("!({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})!", $block_content, $_match2)) { // get child replacement for this block if (isset($template->block_data[$_name])) { $replacement = $template->block_data[$_name]['source']; @@ -119,7 +119,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { } else { $replacement = ''; } - $block_content = preg_replace("/({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})/", $replacement, $block_content); + $block_content = preg_replace("!({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})!", $replacement, $block_content); } if (isset($template->block_data[$_name])) { if (strpos($template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {