r60224 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60223‎ | r60224 | r60225 >
Date:02:58, 19 December 2009
Author:nad
Status:deferred
Tags:
Comment:
escape slashes in value used as regex
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin.php (modified) (history)
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -397,13 +397,14 @@
398398 * - $b is the expression from the recordtable query
399399 */
400400 function cmpCallback( $a, $b, $operator ) {
 401+ $b = str_replace( '/', '\/', $b );
401402 switch ( $operator ) {
402403 case '=':
403 - $cond = preg_match( "|$b|i", $a );
 404+ $cond = preg_match( "/$b/i", $a );
404405 break;
405406
406407 case '!=':
407 - $cond = !preg_match( "|$b|i", $a );
 408+ $cond = !preg_match( "/$b/i", $a );
408409 break;
409410
410411 default:
Index: trunk/extensions/RecordAdmin/RecordAdmin.php
@@ -11,7 +11,7 @@
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
1414
15 -define( 'RECORDADMIN_VERSION', '0.9.7, 2009-12-19' );
 15+define( 'RECORDADMIN_VERSION', '0.9.8, 2009-12-19' );
1616
1717 $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type
1818 $wgRecordAdminCategory = 'Records'; # Category containing record types

Status & tagging log