From 23361af7fd58d576c6c9a1315c98580d8052748c Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 10 Mar 2016 16:18:13 +1100 Subject: [PATCH] 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 --- maintenance/Maintenance.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) 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 ); } } -- 2.20.1