mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-12 08:49:28 +00:00
Fix regex munging by not breaking with regexes with already-escaped /s
This commit is contained in:
parent
5e70316a3a
commit
1bb05bb402
|
@ -152,8 +152,7 @@ class AFPData {
|
|||
$str = $str->toString();
|
||||
$pattern = $regex->toString();
|
||||
|
||||
$pattern = strtr( $pattern, array('/' => '\/') );
|
||||
|
||||
$needle = strtr( $needle, array('\/' => '\/', '/' => '\/') );
|
||||
$pattern = "/$pattern/u";
|
||||
|
||||
wfSuppressWarnings();
|
||||
|
@ -1108,7 +1107,7 @@ class AbuseFilterParser {
|
|||
$haystack = $args[1]->toString();
|
||||
|
||||
## Munge the regex
|
||||
$needle = strtr( $needle, array('/' => '\/') );
|
||||
$needle = strtr( $needle, array('\/' => '\/', '/' => '\/') );
|
||||
$needle = "/$needle/u";
|
||||
|
||||
$count = 0;
|
||||
|
|
Loading…
Reference in a new issue