From: Tim Starling Date: Thu, 10 Mar 2016 05:18:13 +0000 (+1100) Subject: Respect undeclared command line options X-Git-Tag: 1.31.0-rc.0~7658^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=23361af7fd58d576c6c9a1315c98580d8052748c;p=lhc%2Fweb%2Fwiklou.git Respect undeclared command line options This was broken by I847d45684ccd. We should really give an error when an undeclared option is given (not ignore the option as in the previous code), but most commandLine.inc users rely on undeclared options being passed through to the $options global, and the change in I847d45684ccd was apparently accidental. Change-Id: Icec654a386bc79bf3e4ba81644c3c51ac5e093ba --- diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 777eddd192..a08297a647 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -752,17 +752,19 @@ abstract class Maintenance { if ( isset( $this->mParams[$option] ) ) { $multi = $this->mParams[$option]['multiOccurrence']; - $exists = array_key_exists( $option, $options ); - if ( $multi && $exists ) { - $options[$option][] = $value; - } elseif ( $multi ) { - $options[$option] = [ $value ]; - } elseif ( !$exists ) { - $options[$option] = $value; - } else { - $this->error( "\nERROR: $option parameter given twice\n" ); - $this->maybeHelp( true ); - } + } else { + $multi = false; + } + $exists = array_key_exists( $option, $options ); + if ( $multi && $exists ) { + $options[$option][] = $value; + } elseif ( $multi ) { + $options[$option] = [ $value ]; + } elseif ( !$exists ) { + $options[$option] = $value; + } else { + $this->error( "\nERROR: $option parameter given twice\n" ); + $this->maybeHelp( true ); } }