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;