diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FulltextFilter.php b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FulltextFilter.php index e7cbc5000d337..f683e248aec91 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FulltextFilter.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FulltextFilter.php @@ -62,6 +62,16 @@ function ($column) use ($alias) { return $columns; } + /** + * Escape against value + * @param string $value + * @return string + */ + private function escapeAgainstValue(string $value): string + { + return preg_replace('/([+\-><\(\)~*\"@]+)/', ' ', $value); + } + /** * Apply fulltext filters * @@ -86,7 +96,7 @@ public function apply(Collection $collection, Filter $filter) $collection->getSelect() ->where( 'MATCH(' . implode(',', $columns) . ') AGAINST(?)', - $filter->getValue() + $this->escapeAgainstValue($filter->getValue()) ); } }