Fix regex munging by not breaking with regexes with already-escaped /s

This commit is contained in:
Andrew Garrett 2009-03-25 12:15:28 +00:00
parent 5e70316a3a
commit 1bb05bb402

View file

@ -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;