traditional way to fix by using special character in RLIKE
authormonishdeb <monish.deb@webaccessglobal.com>
Wed, 5 Aug 2015 11:45:41 +0000 (17:15 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Thu, 6 Aug 2015 06:49:18 +0000 (12:19 +0530)
CRM/Core/BAO/CustomQuery.php

index 7514a1357339a8f22e7f73cc34f1faf7afc38d9a..747e07a8e14cefaf7aebf1c6655a442107e3f88d 100644 (file)
@@ -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);
                 }
               }