From a0f26a96cc8cf7cba0fa8349aed49c9971b7fbee Mon Sep 17 00:00:00 2001 From: "monte.ohrt" Date: Tue, 2 Jul 2013 14:11:12 +0000 Subject: [PATCH] fix order of replacements (mohrt) --- libs/plugins/outputfilter.trimwhitespace.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/plugins/outputfilter.trimwhitespace.php b/libs/plugins/outputfilter.trimwhitespace.php index 87cf8c78..78ecd441 100644 --- a/libs/plugins/outputfilter.trimwhitespace.php +++ b/libs/plugins/outputfilter.trimwhitespace.php @@ -74,13 +74,11 @@ function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $s // maybe a \0 byte or something is interfering? // $source = trim( $source ); - // capture html elements not to be messed with $_offset = 0; if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { foreach ($matches as $match) { - $store[] = $match[0][0]; $_length = strlen($match[0][0]); - $replace = array_shift($store); + $replace = $store[$match[1][0]]; $source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length); $_offset += strlen($replace) - $_length;