From: Marius Hoch Date: Sun, 9 Jun 2013 01:14:15 +0000 (+0200) Subject: Only show notoken as possible API error once X-Git-Tag: 1.31.0-rc.0~19446^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=4650adb9b27b9149301a0df49931a67c27186bde;p=lhc%2Fweb%2Fwiklou.git Only show notoken as possible API error once Currently notoken is being listed as possible API error twice if it's explicitly set as required parameter and needsToken() returns true. See: https://www.wikidata.org/w/api.php?action=paraminfo&modules=edit Change-Id: Ia17c5cfa634919b43affa146df0d1dc0ff06b758 --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index fdf3b7666b..57287d7cdf 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1597,7 +1597,12 @@ abstract class ApiBase extends ContextSource { } if ( $this->needsToken() ) { - $ret[] = array( 'missingparam', 'token' ); + if ( !isset( $params['token'][ApiBase::PARAM_REQUIRED] ) + || !$params['token'][ApiBase::PARAM_REQUIRED] + ) { + // Add token as possible missing parameter, if not already done + $ret[] = array( 'missingparam', 'token' ); + } $ret[] = array( 'sessionfailure' ); }