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
if ( isset( $this->mParams[$option] ) ) {
$multi = $this->mParams[$option]['multiOccurrence'];
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 );