From 4e4acd955f930984376b641bbe6ded6acdf3eada Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 31 Jul 2013 16:59:32 -0700 Subject: [PATCH] CRM-13139 - CRM_Utils_REST - Accept empty JSON objects ("{}") Note: When the "json" parameter includes malformed JSON (eg "{") or an empty string (""), the behavior is unchanged. This only affects a well-formed empty-obect. ---------------------------------------- * CRM-13139: REST API: json_decode() fails for empty input http://issues.civicrm.org/jira/browse/CRM-13139 --- CRM/Utils/REST.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 6a6971aa10..4403a39e1e 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -378,7 +378,7 @@ class CRM_Utils_REST { if (array_key_exists('json', $_REQUEST) && $_REQUEST['json'][0] == "{") { $params = json_decode($_REQUEST['json'], TRUE); - if(empty($params)) { + if($params === NULL) { echo json_encode(array('is_error' => 1, 'error_message', 'Unable to decode supplied JSON.')); CRM_Utils_System::civiExit(); } -- 2.25.1