From 4650adb9b27b9149301a0df49931a67c27186bde Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Sun, 9 Jun 2013 03:14:15 +0200 Subject: [PATCH] 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 --- includes/api/ApiBase.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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' ); } -- 2.20.1