mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix content search with word ending with hyphen (#7103)
* Fix content search with word ending with hyphen * Update CHANGELOG.md
This commit is contained in:
parent
b438d271b1
commit
9c30e05316
@ -1,6 +1,10 @@
|
||||
HumHub Changelog
|
||||
================
|
||||
|
||||
1.16.2 (Unreleased)
|
||||
---------------------
|
||||
- Fix #7102: Fix content search with word ending with hyphen
|
||||
|
||||
1.16.1 (July 1, 2024)
|
||||
---------------------
|
||||
- Fix #7084: Fix compatibility for PHP 8.0+
|
||||
|
@ -158,6 +158,9 @@ class MysqlDriver extends AbstractDriver
|
||||
|
||||
protected function prepareTerm(string $term): string
|
||||
{
|
||||
// Remove chars `-` to avoid mysql error
|
||||
$term = preg_replace('/-+(\*?)$/', '$1', $term);
|
||||
|
||||
// Wrap a keyword in quotes to avoid error with the special chars in the sql MATCH-AGAINST expression
|
||||
return preg_match('#[^\p{L}\d\*’\'`\-\_]#', $term) ? '"' . $term . '"' : $term;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user