Page MenuHomePhabricator

Api incorrectly calls ApiBase::parseMultiValue if allowed values is given as an array.
Closed, ResolvedPublic

Description

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.


Version: 1.20.x
Severity: normal

Details

Reference
bz33482
TitleReferenceAuthorSource BranchDest Branch
Remove MetricsClient#dispatch()repos/data-engineering/metrics-platform!31phuedxwork/phuedx/T354823main
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:06 AM
bzimport set Reference to bz33482.

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]