Page MenuHomePhabricator

Spurious "this regular expression matches the empty string" warning
Closed, ResolvedPublic

Description

  1. Go to Special:AbuseFilter/new
  2. Type added_lines irlike ("x" + rescape(summary)) into the form, but don't save
  3. Wait for the syntax checker to do its thing

Expected result is no warning. No matter what's in summary, this regex won't match a string not containing "x".

Actual result is a little warning triangle on the left, with the hover text "This regular expression matches the empty string, at character 41"

Were it not for the rescape(), this would make sense; we don't if there's an | in summary. But rescape() should make it "safe".

Event Timeline

Change 661710 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Skip regexp validation if the regex is (partly) unknown

https://gerrit.wikimedia.org/r/661710

Change 661710 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Skip regexp validation if the regex is (partly) unknown

https://gerrit.wikimedia.org/r/661710

That was quick! Probably should have said that the new "live" syntax checker is a really great improvement; thank you for implementing that!

That was quick! Probably should have said that the new "live" syntax checker is a really great improvement; thank you for implementing that!

Glad to hear that :) I was planning to gather some feedback about it, e.g. about the ideal timeout between last edit and syntax check, so I might post at WP:EFN one of these days.