Last modified: 2012-01-03 11:07:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T35482, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 33482 - Api incorrectly calls ApiBase::parseMultiValue if allowed values is given as an array.
Api incorrectly calls ApiBase::parseMultiValue if allowed values is given as ...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.20.x
All All
: Unprioritized normal (vote)
: ---
Assigned To: John Du Hart
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-03 09:50 UTC by Niklas Laxström
Modified: 2012-01-03 11:07 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Niklas Laxström 2012-01-03 09:50:22 UTC
Even though allowed values is given an array, that does not mean that we should parse the input as multivalue. This prevents allowing string values with | in them. This forces to check the param value manually elsewhere in the code.
Comment 1 Santhosh Thottingal 2012-01-03 10:42:26 UTC
As of now, I see this code in ApiBase.php: 

<code>
if ( isset( $value ) && ( $multi || is_array( $type ) ) ) { 
         $value = $this->parseMultiValue( $encParamName, $value, $multi, is_array( $type ) ? $type : null );
}
</code>

May be we need to change that OR to AND condition, so that the value can contain | , even if the allowed values are array when PARAM_ISMULTI is false

There is another bug related to ISMULTI in  APIBase.php

<code>
if ( isset( $paramSettings[self::PARAM_ISMULTI] ) ) {
	$prompt = 'Values (separate with \'|\'): ';
} else {
	$prompt = 'One value: ';
}
</code>

Looks like the condition require additional condition - &&  $paramSettings[self::PARAM_ISMULTI]
Comment 2 John Du Hart 2012-01-03 11:07:15 UTC
r107876

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links