Page MenuHomePhabricator

API: paraminfo errors with certain modules
Closed, ResolvedPublic

Description

Author: matthew.britton

Description:
Using action=paraminfo on the userrights module:

http://en.wikipedia.org/w/api.php?action=paraminfo&modules=userrights

gives the error "The user parameter must be set", as though action=userrights had been called directly. The query works if a 'user' parameter is given -- any user, so long as they exist:

http://en.wikipedia.org/w/api.php?action=paraminfo&modules=userrights&user=User

However, the output of paraminfo is not dependent on this parameter, so it should not be a requirement. No other modules seem to exhibit this behavior; for example

http://en.wikipedia.org/w/api.php?action=paraminfo&modules=edit

works correctly, even though the edit module has required parameters.


Version: 1.17.x
Severity: normal
URL: http://en.wikipedia.org/w/api.php?action=paraminfo&modules=userrights

Details

Reference
bz25248

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:13 PM
bzimport added a project: MediaWiki-API.
bzimport set Reference to bz25248.

matthew.britton wrote:

Actually, turns out it's a bit more broken.

In trunk, the equivalent for rollback also gives the error "The title parameter must be set". On WMF sites it works:

http://en.wikipedia.org/w/api.php?action=paraminfo&modules=rollback

This may be related to the recent changes to "required" parameter validation in the API.

Also in trunk, *all* querymodules (e.g. action=paraminfo&querymodules=allpages) cause paraminfo to fail, with an error like this one:

Catchable fatal error: Argument 1 passed to ApiQueryBase::__construct() must be an instance of ApiQuery, instance of ApiParamInfo given, called in ...\includes\api\ApiQueryBase.php on line 467 and defined in ...\includes\api\ApiQueryBase.php on line 43

matthew.britton wrote:

Querymodule breakage was caused by r72387.

Reedy added a comment.Sep 23 2010, 9:11 AM

I was thinking for the former it must be more widespread (and presumably it is/should be for all modules that have minimum definitely required parameters)

soxred93 wrote:

It looks like the paraminfo errors is caused because before PARAM_REQUIRED, required parameter validations were done in the execute() method. Now they're done in the validate parameter methods. When using ApiParaminfo, the execute() method is not called, but the validate parameter methods are. I'm pretty sure this is the problem.

matthew.britton wrote:

addressed querymodule breakage in r73596

(In reply to comment #3)

I was thinking for the former it must be more widespread (and presumably it
is/should be for all modules that have minimum definitely required parameters)

Only rollback and userrights are affected (haven't tested all extension modules).

That's intriguing... In theory, the purge module (among others?), should also be.

Need to get my dev machine back installed (moved it from my parents last night), and have a poke

soxred93 wrote:

Was going to have a poke at this as well, but realized that when I upgraded to my new OS, I didn't copy the mysql databases. I'll copy them from the backup tonight and have a look.

Reedy added a comment.Oct 1 2010, 7:08 PM

Interesting, on ApiUserrights, disable PARAM_REQUIRED on user, and get

<error code="unknownerror" info="Unknown error: ``&#039;&#039;" xml:space="preserve">

Reedy added a comment.Oct 1 2010, 7:14 PM

And this goes back further, it occurs in 1.16

Userrights didn't exist in 1.15