Monday, March 6, 2017

SUGARCRM: 500 Error when using $GLOBAL['log']->fatal()

Error: HTTP Error: 500 when saving a record.

Code:  Logic hook makes a SOAP call, and then we display the result as follows:
$GLOBALS['log']->fatal('>>>>>' . $response, true); // ERROR HERE


Solution:
$response is returning a JSON object, so we need to escape the result as follows:
$GLOBALS['log']->fatal('>>>>>' . print_r($response, true));

1 comment: