From: Seamus Lee Date: Mon, 22 Mar 2021 06:55:22 +0000 (+1100) Subject: Fix issue with no group by sql_mode X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5dc24de022a91cce45921e6ac80f01d486a3a5c1;p=civicrm-core.git Fix issue with no group by sql_mode --- diff --git a/CRM/Contact/BAO/GroupContactCache.php b/CRM/Contact/BAO/GroupContactCache.php index b63e2c49d0..defc740039 100644 --- a/CRM/Contact/BAO/GroupContactCache.php +++ b/CRM/Contact/BAO/GroupContactCache.php @@ -483,6 +483,8 @@ WHERE id IN ( $groupIDs ) CRM_Core_DAO::executeQuery("INSERT IGNORE INTO $tempTable (group_id, contact_id) {$contactQuery}"); } + CRM_Core_DAO::reenableFullGroupByMode(); + if ($group->children) { // Store a list of contacts who are removed from the parent group diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 9fd3369ab6..1792a1c229 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -3800,6 +3800,7 @@ WHERE a1.is_primary = 0 $currentModes = array_fill_keys(CRM_Utils_SQL::getSqlModes(), 1); $currentModes = array_merge($currentModes, array_fill_keys($modes, 1)); CRM_Core_DAO::executeQuery("SET GLOBAL sql_mode = '" . implode(',', array_keys($currentModes)) . "'"); + CRM_Core_DAO::executeQuery("SET sql_mode = '" . implode(',', array_keys($currentModes)) . "'"); } }