r50413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50412‎ | r50413 | r50414 >
Date:04:06, 10 May 2009
Author:laner
Status:deferred
Tags:
Comment:
Modification in the way preprocessor arguments are parsed.
Modified paths:
  • /trunk/extensions/Plotter/PlotterParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Plotter/PlotterParser.php
@@ -54,15 +54,16 @@
5555 // Parse and sanitize arguments - escape single quotes and backslashes
5656 $arguments = explode( ':', $argv["preprocessorarguments"] );
5757 foreach ( $arguments as $argument ) {
58 - list($argumentkey, $argumentvalue) = explode( '=', $argument );
59 - $argumentkey = preg_replace( '/[^A-Z0-9]/i', '', $argumentkey );
60 - $argumentvalue = preg_replace( "/\\\\/", '\\\\', $argumentvalue );
61 - $argumentvalue = preg_replace( "/'/", "\\'", $argumentvalue );
 58+ $subargumentarr = explode( ',', $argument );
 59+ foreach ( $subargumentarr as &$singleargument ) {
 60+ $singleargument = preg_replace( "/\\\\/", '\\\\', $singleargument );
 61+ $singleargument = preg_replace( "/'/", "\\'", $singleargument );
6262
63 - // Fix escaped separators
64 - $argumentvalue = preg_replace( "/§UNIQ§/", ":", $argumentvalue );
65 - $argumentvalue = preg_replace( "/§UNIQ2§/", ",", $argumentvalue );
66 - $this->argumentArray["preprocessorarguments"][$argumentkey] = $argumentvalue;
 63+ // Fix escaped separators
 64+ $singleargument = preg_replace( "/§UNIQ§/", ":", $singleargument );
 65+ $singleargument = preg_replace( "/§UNIQ2§/", ",", $singleargument );
 66+ }
 67+ $this->argumentArray["preprocessorarguments"][] = $subargumentarr;
6768 }
6869
6970 }
@@ -76,15 +77,13 @@
7778
7879 // Parse and sanitize arguments - escape single quotes and backslashes
7980 $arguments = explode( ',', $argv["scriptarguments"] );
80 - foreach ( $arguments as &$argument ) {
81 - list($argumentkey, $argumentvalue) = explode( '=', $argument );
82 - $argumentkey = preg_replace( '/[^A-Z0-9]/i', '', $argumentkey );
83 - $argumentvalue = preg_replace( "/\\\\/", '\\\\', $argumentvalue );
84 - $argumentvalue = preg_replace( "/'/", "\\'", $argumentvalue );
 81+ foreach ( $arguments as $argument ) {
 82+ $argument = preg_replace( "/\\\\/", '\\\\', $argument );
 83+ $argument = preg_replace( "/'/", "\\'", $argument );
8584
8685 // Fix escaped separators
87 - $argumentvalue = preg_replace( "/§UNIQ§/", ",", $argumentvalue );
88 - $this->argumentArray["scriptarguments"][$argumentkey] = $argumentvalue;
 86+ $argument = preg_replace( "/§UNIQ§/", ",", $argument );
 87+ $this->argumentArray["scriptarguments"][] = $argument;
8988 }
9089 }
9190 if ( isset( $argv["datasep"] ) ) {

Status & tagging log