From 89b30cfbbfcacf3bccf04191d3c132e10bc5b959 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 4 Dec 2013 14:15:14 +0100 Subject: [PATCH] Fix comment issue in Highlighter Multiline comments that have a single line comment as prefix are parsed correctly now --- .../system/bbcode/highlighter/Highlighter.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php index e52bda65f6..38376437fb 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php @@ -197,16 +197,18 @@ abstract class Highlighter extends SingletonFactory { } $cacheCommentsRegEx .= "("; - if (!empty($this->singleLineComment)) { - $cacheCommentsRegEx .= "(?:".implode('|', array_map('preg_quote', $this->singleLineComment)).")[^\n]*"; - if (!empty($this->commentStart)) { + if (!empty($this->commentStart)) { + $cacheCommentsRegEx .= '(?:'.implode('|', array_map('preg_quote', $this->commentStart)).').*?(?:'.implode('|', array_map('preg_quote', $this->commentEnd)).')'; + + if (!empty($this->singleLineComment)) { $cacheCommentsRegEx .= '|'; } } - if (!empty($this->commentStart)) { - $cacheCommentsRegEx .= '(?:'.implode('|', array_map('preg_quote', $this->commentStart)).').*?(?:'.implode('|', array_map('preg_quote', $this->commentEnd)).')'; + if (!empty($this->singleLineComment)) { + $cacheCommentsRegEx .= "(?:".implode('|', array_map('preg_quote', $this->singleLineComment)).")[^\n]*"; } + $cacheCommentsRegEx .= ")"; $this->cacheCommentsRegEx = new Regex($cacheCommentsRegEx, Regex::DOT_ALL); -- 2.20.1