Skip to content

Commit 01b546f

Browse files
FIX for issue#14855 According to MySQL fulltext documentation, AGAINST values shoud be stripped of special chars if they are not intended to be used https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html Searching "*" in any grid list causes a 400 error because of no filtering is applied.
1 parent a53347e commit 01b546f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/FulltextFilter.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ function ($column) use ($alias) {
6262
return $columns;
6363
}
6464

65+
/**
66+
* Escape against value
67+
* @param string $value
68+
* @return string
69+
*/
70+
private function escapeAgainstValue(string $value): string
71+
{
72+
return preg_replace('/([+\-><\(\)~*\"@]+)/', ' ', $value);
73+
}
74+
6575
/**
6676
* Apply fulltext filters
6777
*
@@ -86,7 +96,7 @@ public function apply(Collection $collection, Filter $filter)
8696
$collection->getSelect()
8797
->where(
8898
'MATCH(' . implode(',', $columns) . ') AGAINST(?)',
89-
$filter->getValue()
99+
$this->escapeAgainstValue($filter->getValue())
90100
);
91101
}
92102
}

0 commit comments

Comments
 (0)