From f91f172daa83e122967d204f4a97dc89b9906e20 Mon Sep 17 00:00:00 2001 From: colemanw Date: Wed, 20 Dec 2023 16:36:59 -0500 Subject: [PATCH] dev/core#4872 - Fix APIv4 error when searching contacts with GROUP BY --- Civi/Api4/Utils/FormattingUtil.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Civi/Api4/Utils/FormattingUtil.php b/Civi/Api4/Utils/FormattingUtil.php index ba93b4a278..2aba6212f2 100644 --- a/Civi/Api4/Utils/FormattingUtil.php +++ b/Civi/Api4/Utils/FormattingUtil.php @@ -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) { -- 2.25.1