Last modified: 2014-09-25 16:50:51 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 67054 - API mobileview "protection" sometimes returns object, sometimes returns empty array in JSON output
API mobileview "protection" sometimes returns object, sometimes returns empty...
Status: NEW
Product: MobileFrontend
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 10887
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-24 20:42 UTC by Brion Vibber
Modified: 2014-09-25 16:50 UTC (History)
4 users (show)

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


Attachments

Description Brion Vibber 2014-06-24 20:42:28 UTC
A protected page returns an object/map/dictionary/associative array for the 'protection' property:
http://en.wikipedia.org/w/api.php?action=mobileview&page=Barack_Obama&prop=protection|editable&format=json
{"mobileview":{"sections":[],"protection":{"edit":["autoconfirmed"],"move":["sysop"]},"editable":false}}


But an unprotected page seems to return an empty array instead of an object:

http://en.wikipedia.org/w/api.php?action=mobileview&page=Katakana&prop=protection|editable&format=json
{"mobileview":{"sections":[],"protection":[],"editable":true}}


PHP may consider those the same type, but JSON/JavaScript, Java, Objective-C, etc consider them distinct types and we should be consistent in output to avoid surprises in the clients.
Comment 1 Bingle 2014-06-24 20:45:18 UTC
Prioritization and scheduling of this bug is tracked on Trello card https://trello.com/c/B5Hl0VhY
Comment 2 Brion Vibber 2014-06-24 20:47:24 UTC
Note I can work around this on the client, it's just a pain. :)
Comment 3 Max Semenik 2014-06-24 20:48:23 UTC
Any suggestions how to do it short of rewriting the API in a saner language? :P
Comment 4 Brion Vibber 2014-06-24 20:51:11 UTC
Adding the general bug 10887 as a dep.
Comment 5 Gerrit Notification Bot 2014-06-24 21:32:48 UTC
Change 141842 had a related patch set uploaded by MaxSem:
Make mobileview always return protection as an object

https://gerrit.wikimedia.org/r/141842
Comment 6 Gerrit Notification Bot 2014-06-26 18:43:58 UTC
Change 141842 abandoned by MaxSem:
Make mobileview always return protection as an object

https://gerrit.wikimedia.org/r/141842
Comment 7 Jon 2014-06-26 18:58:31 UTC
Not there is a FIXME in PageApi.js for exactly this reason, would be good to remove that in the fix.

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


Navigation
Links