CRM-20091 - api.CustomValue.gettree - Supply defaults and remove unknown array keys
authorColeman Watts <coleman@civicrm.org>
Thu, 8 Jun 2017 02:51:43 +0000 (22:51 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 8 Jun 2017 02:51:43 +0000 (22:51 -0400)
CRM/Core/BAO/CustomGroup.php

index 12016aa21f94a1071c104d00e3b4e91e5f6ef889..8bb14a8fd9f2a8b82870097c4f105bd7417d02cb 100644 (file)
@@ -425,7 +425,8 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup {
       $toReturn = $tableData;
     }
     else {
-      $toReturn = array_filter($toReturn) + $tableData;
+      // Supply defaults and remove unknown array keys
+      $toReturn = array_intersect_key(array_filter($toReturn) + $tableData, $tableData);
       // Merge in required fields that we must have
       $toReturn['custom_field'] = array_unique(array_merge($toReturn['custom_field'], array('id', 'column_name', 'data_type')));
       $toReturn['custom_group'] = array_unique(array_merge($toReturn['custom_group'], array('id', 'is_multiple', 'table_name', 'name')));