Page MenuHomePhabricator

Invalid JSON produced by API when API error produced
Closed, ResolvedPublic

Description

Author: buzz

Description:
If the api throws an error and the format is set to JSON, the error is additionally tagged onto the end of the JSON making it fail on JSON parsers.

for example

http://en.wikipedia.org/w/api.php?action=invalid&meta=siteinfo&format=json

will produce

{"error":{"code":"unknown_action","info":"Unrecognized value for parameter 'action': invalid"}}unknown_action: Unrecognized value for parameter 'action': invalid

instead of

{"error":{"code":"unknown_action","info":"Unrecognized value for parameter 'action': invalid"}}


Version: 1.13.x
Severity: normal

Details

Reference
bz14758

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:10 PM
bzimport set Reference to bz14758.

Fixed in r37349. The error handler called getAllowedParams() while it was being invoked because getAllowedParams() threw the error in question.