Last modified: 2014-09-25 16:50:51 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.
Prioritization and scheduling of this bug is tracked on Trello card https://trello.com/c/B5Hl0VhY
Note I can work around this on the client, it's just a pain. :)
Any suggestions how to do it short of rewriting the API in a saner language? :P
Adding the general bug 10887 as a dep.
Change 141842 had a related patch set uploaded by MaxSem: Make mobileview always return protection as an object https://gerrit.wikimedia.org/r/141842
Change 141842 abandoned by MaxSem: Make mobileview always return protection as an object https://gerrit.wikimedia.org/r/141842
Not there is a FIXME in PageApi.js for exactly this reason, would be good to remove that in the fix.