dev/core#4872 - Fix APIv4 error when searching contacts with GROUP BY
authorcolemanw <coleman@civicrm.org>
Wed, 20 Dec 2023 21:36:59 +0000 (16:36 -0500)
committercolemanw <coleman@civicrm.org>
Wed, 20 Dec 2023 21:36:59 +0000 (16:36 -0500)
Civi/Api4/Utils/FormattingUtil.php

index ba93b4a2787599899fb0f92f37b39ea2ebb701ac..2aba6212f2107339126e7a1afd66685bfa6c5a80 100644 (file)
@@ -425,7 +425,10 @@ class FormattingUtil {
    *   Path at which these fields are found, e.g. "address.contact."
    * @return array
    */
-  public static function contactFieldsToRemove($contactType, $prefix) {
+  public static function contactFieldsToRemove($contactType, $prefix): array {
+    if (!$contactType || !is_string($contactType)) {
+      return [];
+    }
     if (!isset(\Civi::$statics[__CLASS__][__FUNCTION__][$contactType])) {
       \Civi::$statics[__CLASS__][__FUNCTION__][$contactType] = [];
       foreach (\CRM_Contact_DAO_Contact::fields() as $field) {