From 53df807220d110c1ceb061ff4eb95efe7080abdb Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Mon, 6 Feb 2012 20:53:57 +0000 Subject: [PATCH] - improvement replaced some calls of preg_replace with str_replace (Issue 73) --- change_log.txt | 1 + libs/sysplugins/smarty_internal_compile_include.php | 2 +- libs/sysplugins/smarty_internal_templatebase.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/change_log.txt b/change_log.txt index eff5b698..15e5b7b6 100644 --- a/change_log.txt +++ b/change_log.txt @@ -3,6 +3,7 @@ - improvement stream_resolve_include_path() added to Smarty_Internal_Get_Include_Path (Forum Topic 20980) - bugfix fetch('extends:foo.tpl') always yielded $source->exists == true (Forum Topic 20980) - added modifier unescape:"url", fix (Forum Topic 20980) +- improvement replaced some calls of preg_replace with str_replace (Issue 73) 30.01.2012 - bugfix Smarty_Security internal $_resource_dir cache wasn't properly propagated diff --git a/libs/sysplugins/smarty_internal_compile_include.php b/libs/sysplugins/smarty_internal_compile_include.php index bd050c3f..b18d52dd 100644 --- a/libs/sysplugins/smarty_internal_compile_include.php +++ b/libs/sysplugins/smarty_internal_compile_include.php @@ -155,7 +155,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase { $compiled_code = preg_replace("/(<\?php \/\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\*\/(.+?)\/\*\/%%SmartyHeaderCode%%\*\/\?>\n)/s", '', $compiled_code); if ($tpl->has_nocache_code) { // replace nocache_hash - $compiled_code = preg_replace("/{$tpl->properties['nocache_hash']}/", $compiler->template->properties['nocache_hash'], $compiled_code); + $compiled_code = str_replace("{$tpl->properties['nocache_hash']}", $compiler->template->properties['nocache_hash'], $compiled_code); $compiler->template->has_nocache_code = true; } $compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code; diff --git a/libs/sysplugins/smarty_internal_templatebase.php b/libs/sysplugins/smarty_internal_templatebase.php index b6abc002..d60ecd16 100644 --- a/libs/sysplugins/smarty_internal_templatebase.php +++ b/libs/sysplugins/smarty_internal_templatebase.php @@ -264,7 +264,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output); if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) { // replace nocache_hash - $_output = preg_replace("/{$_template->properties['nocache_hash']}/", $_template->parent->properties['nocache_hash'], $_output); + $_output = str_replace("{$_template->properties['nocache_hash']}", $_template->parent->properties['nocache_hash'], $_output); $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code; } }