From ef616c24b00d0e19f0e5471dbef21d7b84d68650 Mon Sep 17 00:00:00 2001 From: John Du Hart Date: Tue, 3 Jan 2012 11:02:26 +0000 Subject: [PATCH] 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. --- RELEASE-NOTES-1.19 | 2 ++ includes/api/ApiBase.php | 5 +++++ 2 files changed, 7 insertions(+) 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" ); } -- 2.20.1