From: Mathieu Lutfy Date: Sun, 15 May 2016 19:21:40 +0000 (-0400) Subject: CRM-18555: API utils: avoid unset() on empty array. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8919965f5f133b6d1df164c384cf39dcc15e2774;p=civicrm-core.git CRM-18555: API utils: avoid unset() on empty array. --- 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; }