From 59caaa6f716f46ee78445c031550788a22040e2f Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 17 Nov 2016 12:49:34 +0100 Subject: [PATCH] Fixed infinite loop during mention parsing --- .../system/html/input/node/HtmlInputNodeTextParser.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php index 7894724c60..b466393a21 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php @@ -309,9 +309,10 @@ class HtmlInputNodeTextParser { } foreach ($users as $userID => $username) { + $offset = 0; do { $needle = '@' . $username; - $pos = mb_stripos($value, $needle); + $pos = mb_stripos($value, $needle, $offset); // username not found, maybe it is quoted if ($pos === false) { @@ -331,6 +332,8 @@ class HtmlInputNodeTextParser { // and we need to replace them one by one, also avoiding only replacing // the non-quoted username even though both variants are present $value = preg_replace('~' . preg_quote($needle, '~') . '~i', $marker, $value, 1); + + $offset = $pos + 1; } } while ($pos); -- 2.20.1