r92023 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92022‎ | r92023 | r92024 >
Date:23:52, 12 July 2011
Author:nad
Status:deferred
Tags:
Comment:
nope preg_quote not applicable here because the value being passed can be regex syntax
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -282,14 +282,16 @@
283283 */
284284 function cmpCallback( $a, $b, $operator ) {
285285 $b = html_entity_decode( $b, ENT_QUOTES );
286 - $bre = preg_quote( $b, '|' );
 286+ $bre = str_replace( '/', '\/', $b );
 287+ $bre = str_replace( '(', '\(', $bre );
 288+ $bre = str_replace( ')', '\)', $bre );
287289 switch ( $operator ) {
288290 case '=':
289 - $cond = preg_match( "|$bre|i", $a );
 291+ $cond = preg_match( "/$bre/i", $a );
290292 break;
291293
292294 case '!=':
293 - $cond = !preg_match( "|$bre|i", $a );
 295+ $cond = !preg_match( "/$bre/i", $a );
294296 break;
295297
296298 default:

Status & tagging log