From 92eac77dc25a3a3b6dbe4f0d3ab757bbe9eaece0 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Wed, 5 Aug 2015 17:15:41 +0530 Subject: [PATCH] traditional way to fix by using special character in RLIKE --- CRM/Core/BAO/CustomQuery.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CRM/Core/BAO/CustomQuery.php b/CRM/Core/BAO/CustomQuery.php index 7514a13573..747e07a8e1 100644 --- a/CRM/Core/BAO/CustomQuery.php +++ b/CRM/Core/BAO/CustomQuery.php @@ -423,13 +423,14 @@ 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(",", "[[:cntrl:]]*|[[:cntrl:]]*", $value); + $value = str_replace(",", "$specialChar|$specialChar", $value); } $op = (strstr($op, '!') || strstr($op, 'NOT')) ? 'NOT RLIKE' : 'RLIKE'; - $value = "[[:cntrl:]]*" . $value . "[[:cntrl:]]*"; + $value = "$specialChar$value$specialChar"; if (!$wildcard) { - $value = str_replace("[[:cntrl:]]*|", '', $value); + $value = str_replace("$specialChar|", '', $value); } } -- 2.25.1