Bug 33482 - Api incorrectly calls ApiBase::parseMultiValue if allowed values is given...
authorJohn Du Hart <johnduhart@users.mediawiki.org>
Tue, 3 Jan 2012 11:02:26 +0000 (11:02 +0000)
committerJohn Du Hart <johnduhart@users.mediawiki.org>
Tue, 3 Jan 2012 11:02:26 +0000 (11:02 +0000)
Simply means that if you have an array of acceptable values and you only accept one at a time, you can have pipes in the allowed values.

RELEASE-NOTES-1.19
includes/api/ApiBase.php

index 4da9092..9c8eec6 100644 (file)
@@ -213,6 +213,8 @@ production.
   calculated correctly with respect to timezone
 * (bug 32219) InstantCommons now fetches content from Wikimedia Commons using
   HTTPS when the local wiki is served over HTTPS
+* (bug 33482) - Api incorrectly calls ApiBase::parseMultiValue if allowed
+  values is given as an array
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index 992105e..42a5238 100644 (file)
@@ -959,6 +959,11 @@ abstract class ApiBase extends ContextSource {
                }
 
                if ( !$allowMultiple && count( $valuesList ) != 1 ) {
+                       // Bug 33482 - Allow entries with | in them for non-multiple values
+                       if ( in_array( $value, $allowedValues ) ) {
+                               return $value;
+                       }
+
                        $possibleValues = is_array( $allowedValues ) ? "of '" . implode( "', '", $allowedValues ) . "'" : '';
                        $this->dieUsage( "Only one $possibleValues is allowed for parameter '$valueName'", "multival_$valueName" );
                }