From c407847abacad5d13580bd0f486440feb7112a78 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 7 Jun 2021 22:13:25 +0000 Subject: [PATCH] [php8-compat] Fix Include/Exclude Group Custom Search Tests by better handling empty arrays on exclusions in the custom search --- CRM/Contact/Form/Search/Custom/Group.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CRM/Contact/Form/Search/Custom/Group.php b/CRM/Contact/Form/Search/Custom/Group.php index 451bb9ca9a..59c61daf48 100644 --- a/CRM/Contact/Form/Search/Custom/Group.php +++ b/CRM/Contact/Form/Search/Custom/Group.php @@ -301,7 +301,7 @@ class CRM_Contact_Form_Search_Custom_Group extends CRM_Contact_Form_Search_Custo //if no group selected search for all groups $iGroups = NULL; } - if (is_array($this->_excludeGroups)) { + if (is_array($this->_excludeGroups) && !empty($this->_excludeGroups)) { $xGroups = implode(',', $this->_excludeGroups); } else { @@ -309,7 +309,6 @@ class CRM_Contact_Form_Search_Custom_Group extends CRM_Contact_Form_Search_Custo } $this->_xGTable->createWithColumns("contact_id int primary key"); - //used only when exclude group is selected if ($xGroups != 0) { $excludeGroup = "INSERT INTO {$this->_xGTableName} ( contact_id ) @@ -436,7 +435,7 @@ WHERE gcc.group_id = {$ssGroup->id} //if no group selected search for all groups $iTags = NULL; } - if (is_array($this->_excludeTags)) { + if (is_array($this->_excludeTags) && !empty($this->_excludeTags)) { $xTags = implode(',', $this->_excludeTags); } else { -- 2.25.1