I just encountered a problem in the word filter which broke a lot of posts because I didn't know that could happen.
If the "bad word" is being used more than two times in a post and if it is being used in the replaced term as well additionally to any myCode tags, the parser does some weird iterative/recurcive calls.
An example should explain that better:
bad word: poop
filter: [url=badword.redirect?poop]bad word[/url]
phrase: poop poop poop
expected result: bad word bad word bad word (all links)
actual result: bad word]bad word[/url] bad word bad word]bad word[/url]
It doesnt matter how mach text is between each filtered word, it still looks like that for each occurence.
I gave it some further testing and its being consistant if the replaced word is in the new term as well as any myCode tag ([b], [u] and so on). After the replaced word is being used more than once, the above scenario occurs.
Btw. that can be reproduced in the shoutbox (Inferno) as well.
Is there a known workaround for that or can that be fixed?
Please report issues on the forum, as explained in our CONTRIBUTING.md file
The regex search and replace operation maintains a length index, however a non-optimal loop at https://github.com/mybb/mybb/blob/mybb_1808/inc/class_parser.php#L640-L643 prevents it from functioning correctly (resulting in replaced strings being matched again);
this was most likely done to prevent patterns from overlapping (\W is captured and reinserted so cannot be used to match the next word).