From 9004e66bffa248658713ec682d08fad173d48538 Mon Sep 17 00:00:00 2001 From: NorHei Date: Mon, 26 Oct 2015 08:07:14 +0100 Subject: [PATCH] MoveCSStoHead was running into an endless loop on some occasions. Calling phpinfo() from a code section for example. This is the fix from the last public svn of WB. Thx to Kant --- .../output_filter/filters/filterCssToHead.php | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/wbce/modules/output_filter/filters/filterCssToHead.php b/wbce/modules/output_filter/filters/filterCssToHead.php index fbd8dd766..63438a37c 100644 --- a/wbce/modules/output_filter/filters/filterCssToHead.php +++ b/wbce/modules/output_filter/filters/filterCssToHead.php @@ -4,23 +4,23 @@ * @param string $content * @return string */ - function doFilterCssToHead($content) { - // move css definitions into head section - $pattern1 = '/(?:]*?\"text\/css\".*?\/>)/si'; - $pattern2 = '/(?:]*?\"text\/css\"[^>]*?>.*?<\/style>)/si'; - while(preg_match($pattern1, $content, $matches)==1) { - // loop through all linked CSS - $insert = $matches[1]; - $content = str_replace($insert, '', $content); - $insert = "\n".$insert."\n\n.*?\n.*? 0) { + $sInsert = "\n".implode("\n", $aInsert)."\n\n.*?