Last modified: 2014-06-17 16:18:51 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 T68720, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 66720 - Api prop=redirects answers with [] when no redirects exist
Api prop=redirects answers with [] when no redirects exist
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.24rc
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-17 14:19 UTC by Fomafix
Modified: 2014-06-17 16:18 UTC (History)
5 users (show)

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


Attachments

Description Fomafix 2014-06-17 14:19:10 UTC
api.php?action=query&prop=redirects&format=json&rdlimit=10&titles=Foobar&generator=redirects&grdlimit=10

Answers with

{
    "query": {
        "pages": {
            "111": {
                "pageid": 111,
                "ns": 0,
                "title": "Foobar",
                "redirects": [
                    {
                        "pageid": "222",
                        "ns": 0,
                        "title": "Foobar 2"
                    },
                    {
                        "pageid": "333",
                        "ns": 0,
                        "title": "Foobar 3"
                    }
                ]
            }
        }
    }
}

when redirects exits, but it answers with

[]

when no redirects exists.

Expected result:
{
    "query": {
        "pages": {
            "111": {
                "pageid": 111,
                "ns": 0,
                "title": "Foobar",
                "redirects": []
            }
        }
    }
}
Comment 1 Brad Jorsch 2014-06-17 14:20:23 UTC

*** This bug has been marked as a duplicate of bug 10887 ***
Comment 2 Liangent 2014-06-17 15:51:15 UTC
Are they really the same thing? Returning {} instead of [] is not expected here either.
Comment 3 Brad Jorsch 2014-06-17 16:18:51 UTC
(In reply to Liangent from comment #2)
> Are they really the same thing? Returning {} instead of [] is not expected
> here either.

Good point. The bug report is actually incorrect and is just INVALID, and I didn't read it closely enough to notice that.

The text claimed as the response "when redirects exists" is in fact *not* the response that would be given for that query. The response would look more like this:

 {
     "query": {
         "pages": {
             "222": {
                 "pageid": 222,
                 "ns": 0,
                 "title": "Foobar 2"
             },
             "333": {
                 "pageid": 333,
                 "ns": 0,
                 "title": "Foobar 3"
             }
         }
     }
 }

If there are no redirects to "Foobar", then returning "[]" or "{}" is absolutely expected (the difference being a matter for bug 10887).

The query that *does* give the claimed response "when redirects exist" would be something like api.php?action=query&prop=redirects&format=json&rdlimit=10&titles=Foobar. And when no redirects exist, that *does* actually give what is claimed as the "expected" result (except for the fact that the API doesn't normally return an empty subarray, be it for prop=redirects, prop=images, or anything else).

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


Navigation
Links