Last modified: 2013-04-16 20:18:34 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 T49046, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47046 - API gives spurious "unrecognized parameter" warnings for parameters added by extensions
API gives spurious "unrecognized parameter" warnings for parameters added by ...
Status: NEW
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.22.0
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-09 14:31 UTC by Brad Jorsch
Modified: 2013-04-16 20:18 UTC (History)
6 users (show)

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


Attachments

Description Brad Jorsch 2013-04-09 14:31:56 UTC
Extensions are allowed to add parameters to arbitrary API modules. And they can even avoid adding these parameters in a way that module will see them when calling extractRequestParams(). But if the extension does this and then accesses these parameters directly via $wgRequest (which may be required, as the extension may not be able to get access to the ApiMain), ApiMain never knows about it and generates an "unrecognized parameter" warning.
Comment 1 Umherirrender 2013-04-13 17:45:05 UTC
You should use the 'APIGetAllowedParams' hook to add the params, than extractRequestParams() will extract and validate it and marked it as used, than you have not a problem with unrecognized parameters.

With 'APIGetParamDescription' you can add help for the autodoc and action=paraminfo

All other ways are not the common way, so you have to live with such warnings and maybe other things.

Do you want a new hook, when ApiMain::getParamsUsed is called, to add your own parameters there and avoid the warning? Use the first hook, makes live easier, because the api will validate you param and die in a documented way for invalid input.
Comment 2 Brad Jorsch 2013-04-16 20:18:34 UTC
(In reply to comment #1)
> You should use the 'APIGetAllowedParams' hook to add the params, than
> extractRequestParams() will extract and validate it and marked it as used,
> than
> you have not a problem with unrecognized parameters.

I think you are not up to date on the "$flags" parameter that was recently added to APIGetAllowedParams.

Also keep in mind that some very strange things should not show up in the auto-generated help, e.g. how ConfirmEdit copies "captchaid" to "wgCaptchaId".

But perhaps the thing to do is to require anything using APIGetAllowedParams to include its parameters when $flags is 0, and live with modules possibly getting extra parameters returned in extractRequestParams(). I'm not sure.

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


Navigation
Links