}
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) {
// 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);