Page MenuHomePhabricator

Make the logic for showing snippets of searched filters and the filter editor multibyte safe
Closed, ResolvedPublic


For snippets, create a filter with the following pattern:


and run a regex search for "bc". You'll see that the highlighted portion of the string is not "bc", due to special characters. This is due to preg_match, which returns a mb unsafe offset. I'm not sure what the best replacement would be, though.

As for Ace, go editing the above filter using Ace and move to the end of the line: you'll see some whitespace between the end of the string and the caret, again because special character aren't properly handled. I still have to determine whether this is an Ace bug (hard to believe) or we just need to set an appropriate encoding. EDIT: This seems to be

Event Timeline

Change 454070 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] [WIP] Make searched filters highlighting multibyte safe

The snippet problem is addressed in the patch above. As for Ace, it's un upstream problem IIUC. There may be ways to mitigate it, though.

Bad news for Ace: it only supports monospaced fonts, see for instance T50826 or just check on github. There's nothing we can do at the moment, and this problem also affects other things in MW code using Ace (for instance, modules editing).

Change 454070 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Make searched filters highlighting multibyte safe

Daimona removed a project: Patch-For-Review.