From: colemanw Date: Wed, 20 Dec 2023 21:36:59 +0000 (-0500) Subject: dev/core#4872 - Fix APIv4 error when searching contacts with GROUP BY X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f91f172daa83e122967d204f4a97dc89b9906e20;p=civicrm-core.git dev/core#4872 - Fix APIv4 error when searching contacts with GROUP BY --- 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) {