Fix array_key_exists() PHP warning in Report Forms
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>
Fri, 26 Aug 2016 18:12:59 +0000 (14:12 -0400)
committerGitHub <noreply@github.com>
Fri, 26 Aug 2016 18:12:59 +0000 (14:12 -0400)
If the query just below returns an empty set, PHP throws a warning about $customFields being undefined (null), so initialize it properly as an empty array.

CRM/Report/Form.php

index aede7d823aa11c49967a15101f4524a405f9dc60..ccbaea07be552c104879a2e478fa419b4212de8a 100644 (file)
@@ -2090,6 +2090,7 @@ class CRM_Report_Form extends CRM_Core_Form {
       return;
     }
 
+    $customFields = array();
     $customFieldIds = array();
     foreach ($this->_params['fields'] as $fieldAlias => $value) {
       if ($fieldId = CRM_Core_BAO_CustomField::getKeyID($fieldAlias)) {