AbuseFilterParser supports the following empty operators, whereas the CachingParser does not:
- (foo|) is equivalent to foo
- (foo&) is equivalent to false
- (foo&!) is equivalent to foo
- (!) is equivalent to true
- if () ...
- if ( cond ) then () ...
- if ( cond ) then ( ... ) else () end
- var :=
- ()
and also others, see AbuseFilterParserTest::testEmptyOperands.
In all cases, the missing argument of a boolean operator is treated as null.
With this fact, people could inadvertently break filters if they leave a leading operator, so we should really stop allowing it. We should first emit debug notices, then fix filters for WMF prod, and then drop support.
Plan as of 15 Sept
- Formally deprecate empty operands with logging (with a clearer message) in MW 1.34
[] Change logEmptyOperand to be e.g. throwEmptyOperand and throw in MW 1.35 or 1.36. Alternatively, do nothing if the old parser gets dropped before that.
New plan is: leave the deprecation in place and drop the old parser directly (T239990).