Last modified: 2011-03-13 18:05:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 22603 - Malformed response when no params provided
Malformed response when no params provided
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
All All
: Lowest minor (vote)
: ---
Assigned To: Roan Kattouw
Depends on:
  Show dependency treegraph
Reported: 2010-02-21 03:56 UTC by Smallman
Modified: 2011-03-13 18:05 UTC (History)
6 users (show)

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


Description Smallman 2010-02-21 03:56:15 UTC
When looking at

It returns:

You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or API help for more information.

<?xml version="1.0"?>
<api />

This is not valid xml. 

What it should return is: (as when you look at

You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or API help for more information.

<?xml version="1.0"?>
    <general mainpage="Main Page" base="" sitename="Wikipedia" generator="MediaWiki 1.16alpha-wmf" phpversion="5.2.4-2ubuntu5.7wm1" phpsapi="apache2handler" dbtype="mysql" dbversion="5.1.43-wm3193-log" rev="59858" case="first-letter" rights="Creative Commons Attribution-Share Alike 3.0 Unported" lang="en" fallback8bitEncoding="windows-1252" writeapi="" timezone="UTC" timeoffset="0" articlepath="/wiki/$1" scriptpath="/w" script="/w/index.php" variantarticlepath="" server="" wikiid="enwiki" />

There is a related thread at WP:VPT  (
Comment 1 Smallman 2010-02-21 04:04:08 UTC
On second thought, it really should return an error message as does

so it should return something like:

<?xml version="1.0"?>
  <error code="siunknown_siprop" info="Unrecognized value for parameter &#040;siprop&#040;: " xml:space="preserve">

It should return some kind of error message, not a borked api message as it currently does.
Comment 2 Smallman 2010-02-21 04:06:23 UTC
It seems the same error afflicts
Comment 3 Smallman 2010-02-21 04:08:14 UTC also gives bad return...

Tmrw I'll open a small series of bugs after I check all the api modules.
Comment 4 Sam Reed (reedy) 2010-02-21 13:45:01 UTC
Do you really mean version 1.3?
Comment 5 Smallman 2010-02-21 14:01:30 UTC
I thought I hit unspecified...oops.
Comment 6 Smallman 2010-02-21 14:14:24 UTC
I've looked at and the problem is that it assumes there are parameters.

What it should say is something like this

    public function execute() {
        $params = $this->extractRequestParams();
            ApiBase :: dieDebug( __METHOD__, "No prop specified..." );
        $done = array();
        foreach ( $params['prop'] as $p )
It could give better error handling, but it would suffice for now...

It's probably best to add something into extractRequestParams() to make it return an error code when no params are given, rather than go through and add if(empty($params)) to all of the api php scripts...
Comment 7 Bryan Tong Minh 2010-02-21 14:34:38 UTC
If you don't specify something to return, it should not be unexpected that nothing it result.

The response is valid XML anyway:

Recommending WONTFIX.
Comment 8 Smallman 2010-02-21 15:18:45 UTC
You are right, it is valid xml, just not well formed.

Looking at, it returns
<?xml version="1.0"?><api />

I'd like for it to return an error code as no parameter/prop specified.
Comment 9 Alex Z. 2010-02-21 18:24:11 UTC
I tend to agree with Bryan. You're requesting no information, I don't see why its wrong to return no information.
Comment 10 Smallman 2010-02-21 22:36:45 UTC
Well you are specifying which module.

If I do
I do get an error response:
<error code="unknown_action" info="Unrecognized value for parameter 'action': quey"/>

But if I do
I get 

It should throw an error that no parameter was specified, not give no information.
Comment 11 Roan Kattouw 2010-02-22 18:21:48 UTC
Closing as WONTFIX per comment #7.

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