From ecdef330eb57462e49d99c3b0c4e1c976c0e494a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 25 Aug 2014 22:44:21 +0100 Subject: [PATCH] Ensure headers are set correctly for json output --- CRM/Activity/Page/AJAX.php | 6 ++--- CRM/Admin/Page/AJAX.php | 24 ++++++----------- CRM/Badge/Page/AJAX.php | 5 ++-- CRM/Campaign/Page/AJAX.php | 21 +++++---------- CRM/Case/Page/AJAX.php | 6 ++--- CRM/Contact/Form/Inline.php | 3 +-- CRM/Contact/Page/AJAX.php | 39 +++++++++------------------ CRM/Core/IDS.php | 3 +-- CRM/Core/Page/AJAX.php | 4 +-- CRM/Core/Page/AJAX/Location.php | 6 ++--- CRM/Core/QuickForm/Action/Display.php | 3 +-- CRM/Event/Page/AJAX.php | 3 +-- CRM/Financial/Page/AJAX.php | 18 +++++-------- CRM/Group/Page/AJAX.php | 3 +-- CRM/Mailing/Page/AJAX.php | 3 +-- CRM/Member/Page/AJAX.php | 6 ++--- CRM/Queue/ErrorPolicy.php | 3 +-- CRM/Queue/Page/AJAX.php | 3 +-- CRM/UF/Page/AJAX.php | 3 +-- CRM/UF/Page/ProfileEditor.php | 3 +-- CRM/Utils/JSON.php | 3 +-- CRM/Utils/REST.php | 18 +++++-------- 22 files changed, 61 insertions(+), 125 deletions(-) diff --git a/CRM/Activity/Page/AJAX.php b/CRM/Activity/Page/AJAX.php index 2f8faaca95..2c6f56b9c0 100644 --- a/CRM/Activity/Page/AJAX.php +++ b/CRM/Activity/Page/AJAX.php @@ -296,14 +296,12 @@ class CRM_Activity_Page_AJAX { static function convertToCaseActivity() { $params = array('caseID', 'activityID', 'contactID', 'newSubject', 'targetContactIds', 'mode'); + $vals = array(); foreach ($params as $param) { $vals[$param] = CRM_Utils_Array::value($param, $_POST); } - $retval = self::_convertToCaseActivity($vals); - - echo json_encode($retval); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(self::_convertToCaseActivity($vals)); } /** diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index ebc458f0b3..7df95e15ff 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -292,8 +292,7 @@ LIMIT $limit"; } $result[] = $row; } - print json_encode($result); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($result); } function mappingList() { @@ -303,8 +302,7 @@ LIMIT $limit"; } if (!$mappingID) { - echo json_encode(array('error_msg' => 'required params missing.')); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('error_msg' => 'required params missing.')); } $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection1($mappingID); @@ -318,8 +316,7 @@ LIMIT $limit"; ); } - echo json_encode($elements); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($elements); } function mappingList1() { @@ -329,8 +326,7 @@ LIMIT $limit"; } if (!$mappingID) { - echo json_encode(array('error_msg' => 'required params missing.')); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('error_msg' => 'required params missing.')); } $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection1($mappingID); @@ -345,8 +341,7 @@ LIMIT $limit"; } $elements['recipientMapping'] = $recipientMapping; - echo json_encode($elements); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($elements); } static function mergeTags() { @@ -367,8 +362,7 @@ LIMIT $limit"; array(1 => $result['tagA'], 2 => $result['tagB']) ); - echo json_encode($result); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($result); } function recipient() { @@ -378,8 +372,7 @@ LIMIT $limit"; } if (!$recipient) { - echo json_encode(array('error_msg' => 'required params missing.')); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('error_msg' => 'required params missing.')); } switch ($recipient) { @@ -403,8 +396,7 @@ LIMIT $limit"; ); } - echo json_encode($elements); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($elements); } } diff --git a/CRM/Badge/Page/AJAX.php b/CRM/Badge/Page/AJAX.php index 424f34786a..604c2588bb 100644 --- a/CRM/Badge/Page/AJAX.php +++ b/CRM/Badge/Page/AJAX.php @@ -36,7 +36,6 @@ class CRM_Badge_Page_AJAX { static function getImageProp() { $img = $_GET['img']; list($w, $h) = CRM_Badge_BAO_Badge::getImageProperties($img); - echo json_encode(array('width' => $w, 'height' => $h)); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('width' => $w, 'height' => $h)); } -} \ No newline at end of file +} diff --git a/CRM/Campaign/Page/AJAX.php b/CRM/Campaign/Page/AJAX.php index d998914852..3512bc1c4d 100644 --- a/CRM/Campaign/Page/AJAX.php +++ b/CRM/Campaign/Page/AJAX.php @@ -92,8 +92,7 @@ class CRM_Campaign_Page_AJAX { $errors = CRM_Core_BAO_CustomField::validateCustomData($params); if (is_array($errors) && !empty($errors)) { $result['errors'] = $errors; - echo json_encode($result); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($result); } //process the response/interview data. @@ -102,9 +101,7 @@ class CRM_Campaign_Page_AJAX { $result['status'] = 'success'; } - echo json_encode($result); - - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($result); } static function loadOptionGroupDetails() { @@ -144,8 +141,7 @@ class CRM_Campaign_Page_AJAX { 'result' => $opValues, ); - echo json_encode($result); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($result); } function voterList() { @@ -480,8 +476,7 @@ class CRM_Campaign_Page_AJAX { } } - echo json_encode(array('status' => $status)); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('status' => $status)); } function allActiveCampaigns() { @@ -512,9 +507,7 @@ class CRM_Campaign_Page_AJAX { 'campaigns' => $options, ); - echo json_encode($results); - - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($results); } function campaignGroups() { @@ -549,9 +542,7 @@ class CRM_Campaign_Page_AJAX { 'groups' => $groups, ); - echo json_encode($results); - - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($results); } /** diff --git a/CRM/Case/Page/AJAX.php b/CRM/Case/Page/AJAX.php index c5033fdd46..6b83546414 100644 --- a/CRM/Case/Page/AJAX.php +++ b/CRM/Case/Page/AJAX.php @@ -61,8 +61,7 @@ class CRM_Case_Page_AJAX { 'extra' => $details, ); } - print json_encode($results); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($results); } function processCaseTags() { @@ -182,8 +181,7 @@ class CRM_Case_Page_AJAX { ); CRM_Case_BAO_Case::processCaseActivity($caseParams); - echo json_encode(TRUE); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(TRUE); } /** diff --git a/CRM/Contact/Form/Inline.php b/CRM/Contact/Form/Inline.php index 77c6e02d50..ee3d17dfe9 100644 --- a/CRM/Contact/Form/Inline.php +++ b/CRM/Contact/Form/Inline.php @@ -107,8 +107,7 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form { */ public function cancelAction() { $response = array('status' => 'cancel'); - echo json_encode($response); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($response); } /** diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index f26e4acbf8..8473a71c01 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -242,8 +242,7 @@ class CRM_Contact_Page_AJAX { while ($dao->fetch()) { $results[] = array('id' => $dao->id, 'text' => $dao->data); } - print json_encode($results); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($results); } static function relationship() { @@ -305,8 +304,7 @@ class CRM_Contact_Page_AJAX { } } - echo json_encode($ret); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($ret); } /** @@ -319,8 +317,7 @@ class CRM_Contact_Page_AJAX { $values = array(); CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $values, $returnProperties); - echo json_encode($values); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($values); } static function groupTree() { @@ -570,8 +567,7 @@ ORDER BY sort_name "; CRM_Utils_Hook::enableDisable($recordBAO, $recordID, $isActive); } } - echo json_encode($status); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($status); } } @@ -800,8 +796,7 @@ LIMIT {$offset}, {$rowCount} $subTypes = CRM_Contact_BAO_ContactType::subTypePairs($contactType, FALSE, NULL); asort($subTypes); - echo json_encode($subTypes); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($subTypes); } static function buildDedupeRules() { @@ -823,8 +818,7 @@ LIMIT {$offset}, {$rowCount} $dedupeRules = CRM_Dedupe_BAO_RuleGroup::getByType($contactType); - echo json_encode($dedupeRules); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($dedupeRules); } /** @@ -856,8 +850,7 @@ LIMIT {$offset}, {$rowCount} CRM_Utils_System::civiExit(); } - echo json_encode($dashlets); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($dashlets); } /** @@ -876,8 +869,7 @@ LIMIT {$offset}, {$rowCount} ); } - echo json_encode($signatures); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($signatures); } /** @@ -910,8 +902,7 @@ LIMIT {$offset}, {$rowCount} $status = $exception->delete(); } - echo json_encode(array('status' => ($status) ? $oper : $status)); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('status' => ($status) ? $oper : $status)); } static function getDedupes() { @@ -973,8 +964,7 @@ LIMIT {$offset}, {$rowCount} $pdfFormat = CRM_Core_BAO_PdfFormat::getById($formatId); - echo json_encode($pdfFormat); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($pdfFormat); } /** @@ -985,8 +975,7 @@ LIMIT {$offset}, {$rowCount} $paperSize = CRM_Core_BAO_PaperSize::getByName($paperSizeName); - echo json_encode($paperSize); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($paperSize); } static function selectUnselectContacts() { @@ -1020,8 +1009,7 @@ LIMIT {$offset}, {$rowCount} $countSelectionCids = count($contactIds[$cacheKey]); $arrRet = array('getCount' => $countSelectionCids); - echo json_encode($arrRet); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($arrRet); } /** @@ -1050,8 +1038,7 @@ LIMIT {$offset}, {$rowCount} $addressVal = CRM_Core_BAO_Address::getValues($entityBlock); } - echo json_encode($addressVal); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($addressVal); } /** diff --git a/CRM/Core/IDS.php b/CRM/Core/IDS.php index a6e68cf2f8..c6055cf9d8 100644 --- a/CRM/Core/IDS.php +++ b/CRM/Core/IDS.php @@ -275,8 +275,7 @@ class CRM_Core_IDS { 'reason' => 'XSS suspected', ) ); - echo json_encode($error); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($error); } CRM_Core_Error::fatal($msg); } diff --git a/CRM/Core/Page/AJAX.php b/CRM/Core/Page/AJAX.php index 593beb5f3c..42ac838b46 100644 --- a/CRM/Core/Page/AJAX.php +++ b/CRM/Core/Page/AJAX.php @@ -126,9 +126,7 @@ class CRM_Core_Page_AJAX { if (!$result) { $priceSetId = null; } - echo json_encode($priceSetId); - - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($priceSetId); } /** diff --git a/CRM/Core/Page/AJAX/Location.php b/CRM/Core/Page/AJAX/Location.php index d4e126ae97..90e553da63 100644 --- a/CRM/Core/Page/AJAX/Location.php +++ b/CRM/Core/Page/AJAX/Location.php @@ -195,8 +195,7 @@ class CRM_Core_Page_AJAX_Location { } } - echo json_encode($elements); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($elements); } static function jqState() { @@ -259,7 +258,6 @@ class CRM_Core_Page_AJAX_Location { // set the message if loc block is being used by more than one event. $result['count_loc_used'] = CRM_Event_BAO_Event::countEventsUsingLocBlockId($_POST['lbid']); - echo json_encode($result); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($result); } } diff --git a/CRM/Core/QuickForm/Action/Display.php b/CRM/Core/QuickForm/Action/Display.php index f7d20fcf02..d785e34c63 100644 --- a/CRM/Core/QuickForm/Action/Display.php +++ b/CRM/Core/QuickForm/Action/Display.php @@ -119,8 +119,7 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action { // Deprecated - use snippet=6 instead of json=1 $json = CRM_Utils_Request::retrieve('json', 'Boolean', CRM_Core_DAO::$_nullObject); if ($json) { - echo json_encode($form); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($form); } $template->assign('form', $form); diff --git a/CRM/Event/Page/AJAX.php b/CRM/Event/Page/AJAX.php index 355c473f74..5302013271 100644 --- a/CRM/Event/Page/AJAX.php +++ b/CRM/Event/Page/AJAX.php @@ -64,8 +64,7 @@ GROUP BY cv.label"; while ($dao->fetch()) { $results[] = array('id' => $dao->id, 'text' => $dao->label); } - echo json_encode($results); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($results); } } diff --git a/CRM/Financial/Page/AJAX.php b/CRM/Financial/Page/AJAX.php index 98c1a43a4d..eea4ff4bc4 100644 --- a/CRM/Financial/Page/AJAX.php +++ b/CRM/Financial/Page/AJAX.php @@ -90,8 +90,7 @@ class CRM_Financial_Page_AJAX { ) + $selectedArray; } } - echo json_encode($elements); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($elements); } /** @@ -150,8 +149,7 @@ class CRM_Financial_Page_AJAX { } } } - echo json_encode($elements); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($elements); } /** @@ -164,8 +162,7 @@ class CRM_Financial_Page_AJAX { } $elements = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Product', $_GET['_value'], 'financial_type_id'); - echo json_encode($elements); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($elements); } /** @@ -257,8 +254,7 @@ class CRM_Financial_Page_AJAX { } } } - echo json_encode($response); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($response); } static function getFinancialTransactionsList() { @@ -490,8 +486,7 @@ class CRM_Financial_Page_AJAX { else { $status = array('status' => ts("This batch is configured to include only transactions using %1 payment method. If you want to include other transactions, please edit the batch first and modify the Payment Method.", array( 1 => $paymentInstrument))); } - echo json_encode($status); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($status); } static function getBatchSummary() { @@ -512,7 +507,6 @@ class CRM_Financial_Page_AJAX { 'opened_date' => CRM_Utils_Date::customFormat($batchInfo->created_date), ); - echo json_encode($batchSummary); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($batchSummary); } } diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php index cffa28a9ef..8f6887e4d6 100644 --- a/CRM/Group/Page/AJAX.php +++ b/CRM/Group/Page/AJAX.php @@ -45,8 +45,7 @@ class CRM_Group_Page_AJAX { $params['rp'] = 0; $groups = CRM_Contact_BAO_Group::getGroupListSelector($params); - echo json_encode($groups); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($groups); } else { $sortMapper = array( diff --git a/CRM/Mailing/Page/AJAX.php b/CRM/Mailing/Page/AJAX.php index 4ae393f008..44b45a30dd 100644 --- a/CRM/Mailing/Page/AJAX.php +++ b/CRM/Mailing/Page/AJAX.php @@ -56,8 +56,7 @@ class CRM_Mailing_Page_AJAX { 'pdf_format_id' => $messageTemplate->pdf_format_id, ); - echo json_encode($messages); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($messages); } /** diff --git a/CRM/Member/Page/AJAX.php b/CRM/Member/Page/AJAX.php index c49e526968..460081eb2d 100644 --- a/CRM/Member/Page/AJAX.php +++ b/CRM/Member/Page/AJAX.php @@ -47,8 +47,7 @@ class CRM_Member_Page_AJAX { $details['auto_renew'] = ''; $details['total_amount'] = ''; - echo json_encode($details); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($details); } $memType = CRM_Utils_Type::escape($_POST['mtype'], 'Integer'); @@ -68,8 +67,7 @@ WHERE id = %1"; $details['total_amount'] = CRM_Utils_Money::format($details['total_amount'], NULL, '%a'); $options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required ')); $details['auto_renew'] = CRM_Utils_Array::value('auto_renew', $options[$details]); - echo json_encode($details); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($details); } } diff --git a/CRM/Queue/ErrorPolicy.php b/CRM/Queue/ErrorPolicy.php index e30fbe6d97..14f0812808 100644 --- a/CRM/Queue/ErrorPolicy.php +++ b/CRM/Queue/ErrorPolicy.php @@ -168,8 +168,7 @@ class CRM_Queue_ErrorPolicy { if (is_object($activeQueueRunner)) { $response['last_task_title'] = $activeQueueRunner->lastTaskTitle; } - echo json_encode($response); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($response); } } diff --git a/CRM/Queue/Page/AJAX.php b/CRM/Queue/Page/AJAX.php index 2b87ac5792..bf6d267e4c 100644 --- a/CRM/Queue/Page/AJAX.php +++ b/CRM/Queue/Page/AJAX.php @@ -112,8 +112,7 @@ class CRM_Queue_Page_AJAX { CRM_Core_Error::debug_var("CRM_Queue_Page_AJAX_{$op}_error", $result); } } - echo json_encode($result); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($result); } } diff --git a/CRM/UF/Page/AJAX.php b/CRM/UF/Page/AJAX.php index 2a8555583d..4b3ec9dacd 100644 --- a/CRM/UF/Page/AJAX.php +++ b/CRM/UF/Page/AJAX.php @@ -47,7 +47,6 @@ class CRM_UF_Page_AJAX { $isMultiple = CRM_Core_BAO_CustomField::isMultiRecordField($customId); $isMultiple = array('is_multi' => $isMultiple); - echo json_encode($isMultiple); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($isMultiple); } } diff --git a/CRM/UF/Page/ProfileEditor.php b/CRM/UF/Page/ProfileEditor.php index 6b2b33282b..6c16846939 100644 --- a/CRM/UF/Page/ProfileEditor.php +++ b/CRM/UF/Page/ProfileEditor.php @@ -81,8 +81,7 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page { */ static function getSchemaJSON() { $entityTypes = explode(',', $_REQUEST['entityTypes']); - echo json_encode(self::getSchema($entityTypes)); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(self::getSchema($entityTypes)); } /** diff --git a/CRM/Utils/JSON.php b/CRM/Utils/JSON.php index 00287a5eaa..3052403c25 100644 --- a/CRM/Utils/JSON.php +++ b/CRM/Utils/JSON.php @@ -44,8 +44,7 @@ class CRM_Utils_JSON { */ static function output($input) { header('Content-Type: application/json'); - echo json_encode($input); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($input); } /** diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 6539aade42..010cfe8156 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -421,8 +421,7 @@ class CRM_Utils_REST { if (array_key_exists('json', $requestParams) && $requestParams['json'][0] == "{") { $params = json_decode($requestParams['json'], TRUE); if($params === NULL) { - echo json_encode(array('is_error' => 1, 'error_message', 'Unable to decode supplied JSON.')); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('is_error' => 1, 'error_message', 'Unable to decode supplied JSON.')); } } foreach ($requestParams as $n => $v) { @@ -541,16 +540,13 @@ class CRM_Utils_REST { 'reason' => 'CSRF suspected', ) ); - echo json_encode($error); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($error); } if (empty($requestParams['entity'])) { - echo json_encode(civicrm_api3_create_error('missing entity param')); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(civicrm_api3_create_error('missing entity param')); } if (empty($requestParams['entity'])) { - echo json_encode(civicrm_api3_create_error('missing entity entity')); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(civicrm_api3_create_error('missing entity entity')); } if (!empty($requestParams['json'])) { $params = json_decode($requestParams['json'], TRUE); @@ -558,8 +554,7 @@ class CRM_Utils_REST { $entity = CRM_Utils_String::munge(CRM_Utils_Array::value('entity', $requestParams)); $action = CRM_Utils_String::munge(CRM_Utils_Array::value('action', $requestParams)); if (!is_array($params)) { - echo json_encode(array('is_error' => 1, 'error_message', 'invalid json format: ?{"param_with_double_quote":"value"}')); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output(array('is_error' => 1, 'error_message', 'invalid json format: ?{"param_with_double_quote":"value"}')); } $params['check_permissions'] = TRUE; @@ -600,8 +595,7 @@ class CRM_Utils_REST { 'reason' => 'CSRF suspected', ) ); - echo json_encode($error); - CRM_Utils_System::civiExit(); + CRM_Utils_JSON::output($error); } $q = CRM_Utils_Array::value('fnName', $requestParams); -- 2.25.1