Page MenuHomePhabricator

SpamBlacklist: Fix "PHP Warning: preg_match(): Compilation failed: nothing to repeat" in EmailBlacklist
Closed, ResolvedPublic

Description

PHP Warning: preg_match(): Compilation failed: nothing to repeat at offset 13 in /usr/local/apache/common-local/php-1.23wmf17/extensions/SpamBlacklist/EmailBlacklist.php on line 52

[logstash] message_checksum: 7d3b1ee239c9d08033c5a588728a2bbd

Source code: https://github.com/wikimedia/mediawiki-extensions-SpamBlacklist/blob/2e6259f35fe526/EmailBlacklist.php#L49-L53


Version: unspecified
Severity: major

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:05 AM
bzimport added a project: SpamBlacklist.
bzimport set Reference to bz62864.
bzimport added a subscriber: Unknown Object (MLST).
Krinkle created this task.Mar 20 2014, 3:38 AM
Reedy added a comment.Mar 20 2014, 3:43 AM

Noting this isn't really a code quality issue, it's somewhat a config issue.

The problem is likely to live somewhere on http://meta.wikimedia.org/w/index.php?title=Spam_blacklist&action=raw&sb_ver=1

Noting this isn't really a code quality issue, it's somewhat a config issue.

The problem is likely to live somewhere on http://meta.wikimedia.org/w/index.php?title=Spam_blacklist&action=raw&sb_ver=1

If the intention is to support arbitrary user input as regexes, and to allow saving this input without validation, then the extension must explicitly catch these warnings and explicitly behave how it wants to (in this case, by ignoring the entry).

Currently the code is written as if the input is always valid, thus the error indicates that the application is broken, alerting deployers and SRE instead of end-users. If it really is of interest to maintainers of the extension (who) then it could be logged to its own log channel instead (not php errors).

matmarex claimed this task.Nov 7 2019, 10:00 PM

Change 549654 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/SpamBlacklist@master] EmailBlacklist: Suppress warnings from invalid user-supplied regexes

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

By the way, I don't see any instances of this error in the last 30 days in Logstash.

Change 549654 merged by jenkins-bot:
[mediawiki/extensions/SpamBlacklist@master] EmailBlacklist: Suppress warnings from invalid user-supplied regexes

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

Krinkle closed this task as Resolved.Dec 17 2019, 6:48 PM