Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Crash when receiving invalid JSON response #215

Open
inghamn opened this issue Feb 3, 2014 · 1 comment
Open

Crash when receiving invalid JSON response #215

inghamn opened this issue Feb 3, 2014 · 1 comment
Labels
Milestone

Comments

@inghamn
Copy link
Member

inghamn commented Feb 3, 2014

For various reasons, an Open311 server may spit out invalid JSON in the response. Right now the app just crashes when this happens. We need to do error checking on the response and handle it in a nicer way.

@inghamn
Copy link
Member Author

inghamn commented Feb 3, 2014

The Cocoa errors 3840 is coming from uReport spitting out an HTML error message in the JSON response. I'll need to also make sure uReport only spits out JSON errors.

If I POST to it using Open311 Generic POST (Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n
\r\n
api_key=XXXX=&jurisdiction_id=matthewncockburn.com&first_name=Matthew&last_name=Cockburn&&service_code=1&lat=55.5&long=-2.55&\r\n
attribute[WHISPAWN]=123456&attribute[WHISDORN]=COISL001) I get:

\n\n\n\n\n\n\n\n\n\n\n

( ! ) Catchable fatal error: Argument 1 passed to Ticket::setAssignedPerson() must be an instance of Person, null given, called in /var/www/sites/crm/models/Ticket.php on line 125 and defined in /var/www/sites/crm/models/Ticket.php on line 209
Call Stack
#TimeMemoryFunctionLocation
10.0003262472{main}( )../index.php:0
20.01791719808Open311Controller->requests( )../index.php:68
30.34443373472Ticket->handleAdd( $post = array ('client_id' => NULL, 'contactMethod_id' => NULL, 'category_id' => '1', 'latitude' => '55.5', 'longitude' => '-2.55', 'customFields' => array ('WHISDORN' => 'COISL001'), 'reportedByPerson_id' => '9') )../Open311Controller.php:98
40.34663489960Ticket->save( )../Ticket.php:576
50.34663490304ActiveRecord->save( )../Ticket.php:144
60.34663490864Ticket->validate( )../ActiveRecord.php:21
70.34773570456Ticket->setAssignedPerson( $o = NULL )../Ticket.php:125

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant