r48811 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48810‎ | r48811 | r48812 >
Date:12:43, 25 March 2009
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Properly fix regex munging
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.parser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php
@@ -152,7 +152,7 @@
153153 $str = $str->toString();
154154 $pattern = $regex->toString();
155155
156 - $needle = strtr( $needle, array('\/' => '\/', '/' => '\/') );
 156+ $pattern = preg_replace( '!(\\\\\\\\)*(\\\\)?/!', '$1\/', $pattern );
157157 $pattern = "/$pattern/u";
158158
159159 wfSuppressWarnings();
@@ -1107,7 +1107,7 @@
11081108 $haystack = $args[1]->toString();
11091109
11101110 ## Munge the regex
1111 - $needle = strtr( $needle, array('\/' => '\/', '/' => '\/') );
 1111+ $needle = preg_replace( '!(\\\\\\\\)*(\\\\)?/!', '$1\/', $needle );
11121112 $needle = "/$needle/u";
11131113
11141114 $count = 0;

Follow-up revisions

RevisionCommit summaryAuthorDate
r50060Branch for MediaWiki 1.15. Copying from the version currently deployed on Wik...tstarling04:11, 30 April 2009
r50061Branch for MediaWiki 1.15 from trunk r48811.tstarling04:16, 30 April 2009
r50088Increment version to 1.16. Basic release notes update assuming r48811 branch ...tstarling03:38, 1 May 2009

Comments

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

regex make my head hurt at 6am

Status & tagging log