From cdbc6ac349d2d967397f553a2878bca6f4728ea7 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Thu, 6 Aug 2015 11:51:31 +1200 Subject: [PATCH] CRM-16961 fix for search for cust data with parentheses Conflicts: CRM/Core/BAO/CustomQuery.php ---------------------------------------- * CRM-16961: 4.6.5 search regression on custom fields where option values have brackets https://issues.civicrm.org/jira/browse/CRM-16961 --- CRM/Core/BAO/CustomQuery.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/CustomQuery.php b/CRM/Core/BAO/CustomQuery.php index 747e07a8e1..34f2df43bd 100644 --- a/CRM/Core/BAO/CustomQuery.php +++ b/CRM/Core/BAO/CustomQuery.php @@ -423,14 +423,15 @@ SELECT label, value // CRM-14563,CRM-16575 : Special handling of multi-select custom fields if ($isSerialized && !empty($value)) { - $specialChar = '[' . CRM_Core_DAO::VALUE_SEPARATOR . ']*'; if (strstr($op, 'IN')) { - $value = str_replace(",", "$specialChar|$specialChar", $value); + $value = str_replace(",", "[[:cntrl:]]*|[[:cntrl:]]*", $value); + $value = str_replace('(', '[[.left-parenthesis.]]', $value); + $value = str_replace(')', '[[.right-parenthesis.]]', $value); } $op = (strstr($op, '!') || strstr($op, 'NOT')) ? 'NOT RLIKE' : 'RLIKE'; - $value = "$specialChar$value$specialChar"; + $value = "[[:cntrl:]]*" . $value . "[[:cntrl:]]*"; if (!$wildcard) { - $value = str_replace("$specialChar|", '', $value); + $value = str_replace("[[:cntrl:]]*|", '', $value); } } -- 2.25.1