From: eileen Date: Mon, 26 Oct 2020 05:56:58 +0000 (+1300) Subject: dev/core#2132 Fix for sort on search results X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6dc40f3250ede0f38ce2aed7c3fabd3f1f667c1b;p=civicrm-core.git dev/core#2132 Fix for sort on search results Simpler fix - accept bad sql but catch it :-( Ideally we would always be in exception mode --- diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 2296ddd2e4..0986377581 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -1018,6 +1018,8 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se */ public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = self::CACHE_SIZE) { $coreSearch = TRUE; + // This ensures exceptions are caught in the try-catch. + $handling = CRM_Core_TemporaryErrorScope::useException(); // For custom searches, use the contactIDs method if (is_a($this, 'CRM_Contact_Selector_Custom')) { $sql = $this->_search->contactIDs($start, $end, $sort, TRUE); @@ -1046,7 +1048,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se try { Civi::service('prevnext')->fillWithSql($cacheKey, $sql); } - catch (CRM_Core_Exception $e) { + catch (\Exception $e) { if ($coreSearch) { // in the case of error, try rebuilding cache using full sql which is used for search selector display // this fixes the bugs reported in CRM-13996 & CRM-14438