Open inghamn opened 10 years ago
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( ! ) 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 \nCall Stack \n# Time Memory Function Location \n1 0.0003 262472 {main}( ) ../index.php:0 \n2 0.0179 1719808 Open311Controller->requests( ) ../index.php:68 \n3 0.3444 3373472 Ticket->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 \n4 0.3466 3489960 Ticket->save( ) ../Ticket.php:576 \n5 0.3466 3490304 ActiveRecord->save( ) ../Ticket.php:144 \n6 0.3466 3490864 Ticket->validate( ) ../ActiveRecord.php:21 \n
7 0.3477 3570456 Ticket->setAssignedPerson( $o = NULL ) ../Ticket.php:125
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.