From: John Du Hart Date: Tue, 3 Jan 2012 11:02:26 +0000 (+0000) Subject: Bug 33482 - Api incorrectly calls ApiBase::parseMultiValue if allowed values is given... X-Git-Tag: 1.31.0-rc.0~25598 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=ef616c24b00d0e19f0e5471dbef21d7b84d68650;p=lhc%2Fweb%2Fwiklou.git Bug 33482 - Api incorrectly calls ApiBase::parseMultiValue if allowed values is given as an array 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. --- diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 4da9092346..9c8eec63b2 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -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. diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 992105ee98..42a5238283 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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" ); }