From 14f4cbf4495ea99751591e210281dc837aad7474 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 7 Apr 2023 10:24:52 +1200 Subject: [PATCH] Use mb_strtolower to compare translated strings --- CRM/Core/BAO/CustomQuery.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/CustomQuery.php b/CRM/Core/BAO/CustomQuery.php index 621441bc76..98d8d68bc0 100644 --- a/CRM/Core/BAO/CustomQuery.php +++ b/CRM/Core/BAO/CustomQuery.php @@ -223,7 +223,7 @@ class CRM_Core_BAO_CustomQuery { else { // fix $value here to escape sql injection attacks if (!is_array($value)) { - if ($field['data_type'] == 'String') { + if ($field['data_type'] === 'String') { $value = CRM_Utils_Type::escape($value, 'String'); } elseif ($value) { @@ -242,7 +242,7 @@ class CRM_Core_BAO_CustomQuery { foreach ($value as $key => $val) { $value[$key] = str_replace(['[', ']', ','], ['\[', '\]', '[:comma:]'], $val); $value[$key] = str_replace('|', '[:separator:]', $value[$key]); - if ($field['data_type'] == 'String') { + if ($field['data_type'] === 'String') { $value[$key] = CRM_Utils_Type::escape($value[$key], 'String'); } elseif ($value) { @@ -281,12 +281,12 @@ class CRM_Core_BAO_CustomQuery { case 'Int': $this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'Integer'); - $this->_qill[$grouping][] = ts("%1 %2 %3", [1 => $field['label'], 2 => $qillOp, 3 => $qillValue]); + $this->_qill[$grouping][] = ts('%1 %2 %3', [1 => $field['label'], 2 => $qillOp, 3 => $qillValue]); break; case 'Boolean': if (!is_array($value)) { - if (strtolower($value) == 'yes' || strtolower($value) == strtolower(ts('Yes'))) { + if (mb_strtolower($value) === 'yes' || mb_strtolower($value) === mb_strtolower(ts('Yes'))) { $value = 1; } else { -- 2.25.1