From 8919965f5f133b6d1df164c384cf39dcc15e2774 Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Sun, 15 May 2016 15:21:40 -0400 Subject: [PATCH] CRM-18555: API utils: avoid unset() on empty array. --- api/v3/utils.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/api/v3/utils.php b/api/v3/utils.php index 916eae4c04..cb1709391f 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -134,12 +134,14 @@ function civicrm_api3_create_error($msg, $data = array()) { // we will show sql to privileged user only (not sure of a specific // security hole here but seems sensible - perhaps should apply to the trace as well?) - if (isset($data['sql']) && (CRM_Core_Permission::check('Administer CiviCRM') || CIVICRM_UF == 'UnitTests')) { - // Isn't this redundant? - $data['debug_information'] = $data['sql']; - } - else { - unset($data['sql']); + if (isset($data['sql'])) { + if (CRM_Core_Permission::check('Administer CiviCRM') || CIVICRM_UF == 'UnitTests') { + // Isn't this redundant? + $data['debug_information'] = $data['sql']; + } + else { + unset($data['sql']); + } } return $data; } -- 2.25.1