r48809 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48808‎ | r48809 | r48810 >
Date:12:15, 25 March 2009
Author:werdna
Status:resolved (Comments)
Tags:
Comment:
Fix regex munging by not breaking with regexes with already-escaped /s
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.parser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php
@@ -152,8 +152,7 @@
153153 $str = $str->toString();
154154 $pattern = $regex->toString();
155155
156 - $pattern = strtr( $pattern, array('/' => '\/') );
157 -
 156+ $needle = strtr( $needle, array('\/' => '\/', '/' => '\/') );
158157 $pattern = "/$pattern/u";
159158
160159 wfSuppressWarnings();
@@ -1108,7 +1107,7 @@
11091108 $haystack = $args[1]->toString();
11101109
11111110 ## Munge the regex
1112 - $needle = strtr( $needle, array('/' => '\/') );
 1111+ $needle = strtr( $needle, array('\/' => '\/', '/' => '\/') );
11131112 $needle = "/$needle/u";
11141113
11151114 $count = 0;

Comments

#Comment by Brion VIBBER (talk | contribs)   12:46, 25 March 2009

r48811 pokes this up a bit more

Status & tagging log