From fc7b772ba3bbb646a3860c99fbd9c72ad20df3af Mon Sep 17 00:00:00 2001 From: acognet Date: Mon, 30 Mar 2020 16:11:57 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B01910=20-=20iTop=20-=20Search=20on=20Text?= =?UTF-8?q?=20contains=20"=5F"=20not=20working=20=5F=20is=20a=20special=20?= =?UTF-8?q?caracter=20in=20mysql=20->=20replace=20with=20\=5F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/UI.php | 4 ++-- .../search/criterionconversion/criteriontooql.class.inc.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pages/UI.php b/pages/UI.php index a6f76a329..7bf8491e8 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -564,7 +564,7 @@ try $sFullText = trim($aMatches[2]); } } - + $sFullText = str_replace('_', '\_', $sFullText); if (preg_match('/^"(.*)"$/', $sFullText, $aMatches)) { // The text is surrounded by double-quotes, remove the quotes and treat it as one single expression @@ -596,7 +596,7 @@ try break; } $sFullText = implode(' ', $aFullTextNeedles); - + $sFullText = str_replace('\_', '_', $sFullText); // Sanity check of the accelerators /** @var array $aAccelerators */ $aAccelerators = MetaModel::GetConfig()->Get('full_text_accelerators'); diff --git a/sources/application/search/criterionconversion/criteriontooql.class.inc.php b/sources/application/search/criterionconversion/criteriontooql.class.inc.php index 0c70778d2..cc90ae6f8 100644 --- a/sources/application/search/criterionconversion/criteriontooql.class.inc.php +++ b/sources/application/search/criterionconversion/criteriontooql.class.inc.php @@ -123,6 +123,7 @@ class CriterionToOQL extends CriterionConversionAbstract { return "1"; } + $sValue = str_replace('_', '\_', $sValue); return "({$sRef} LIKE '%{$sValue}%')"; }