r66603 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66602‎ | r66603 | r66604 >
Date:04:47, 18 May 2010
Author:nad
Status:deferred (Comments)
Tags:
Comment:
no 'g' modifier in PHP regex
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -420,7 +420,7 @@
421421 * - $b is the expression from the recordtable query
422422 */
423423 function cmpCallback( $a, $b, $operator ) {
424 - $b = preg_replace( "|([/']|g", "\\$1", $b );
 424+ $b = preg_replace( "|([/']|", "\\$1", $b );
425425 switch ( $operator ) {
426426 case '=':
427427 $cond = preg_match( "/$b/i", $a );

Comments

#Comment by Tim Starling (talk | contribs)   04:51, 18 May 2010

If you actually want to stop after one match, you should use the $limit parameter to preg_replace().

Status & tagging log