From 3cb166ba4a9021bfc20605403b518dc2d81cf795 Mon Sep 17 00:00:00 2001 From: messju Date: Sat, 26 Nov 2005 16:59:02 +0000 Subject: [PATCH] fixed handling of multiple identical calls to {insert}. the function was called multiple times, but all inserts where replaced by the results of the first call to the insert function. --- NEWS | 1 + libs/internals/core.process_cached_inserts.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 31eb61ea..5d3cf392 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - fix handling of multiple identical inserts in one display()-call (messju) - replace {} string access with equivalent substr() to avoid E_STRICT warnings in PHP 5.1 (boots) - return valid reference in get_config_vars() when given var is diff --git a/libs/internals/core.process_cached_inserts.php b/libs/internals/core.process_cached_inserts.php index 29cb007e..1d78edd9 100644 --- a/libs/internals/core.process_cached_inserts.php +++ b/libs/internals/core.process_cached_inserts.php @@ -52,7 +52,7 @@ function smarty_core_process_cached_inserts($params, &$smarty) $replace = ''; } - $params['results'] = str_replace($cached_inserts[$i], $replace, $params['results']); + $params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i])); if ($smarty->debugging) { $_params = array(); require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');