mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 09:44:38 +02:00
Fix issue processwire/processwire-issues#1240
This commit is contained in:
@@ -2504,12 +2504,11 @@ class PageFinder extends Wire {
|
|||||||
$s = '';
|
$s = '';
|
||||||
foreach(explode(' ', $value) as $n => $word) {
|
foreach(explode(' ', $value) as $n => $word) {
|
||||||
$word = $sanitizer->pageName($word, Sanitizer::toAscii);
|
$word = $sanitizer->pageName($word, Sanitizer::toAscii);
|
||||||
$mySQL8 = false; // @todo add version check
|
if($database->getRegexEngine() === 'ICU') {
|
||||||
if($mySQL8) {
|
// MySQL 8.0.4+ uses ICU regex engine where "\\b" is used for word boundary
|
||||||
// confirm the statement below works in MySQL 8.x because "\\b" has
|
|
||||||
// very different regex meaning between 8.x and versions prior to it
|
|
||||||
$bindKey = $query->bindValueGetKey("\\b$word\\b");
|
$bindKey = $query->bindValueGetKey("\\b$word\\b");
|
||||||
} else {
|
} else {
|
||||||
|
// this Henry Spencer regex engine syntax works only in MySQL 8.0.3 and prior
|
||||||
$bindKey = $query->bindValueGetKey('[[:<:]]' . $word . '[[:>:]]');
|
$bindKey = $query->bindValueGetKey('[[:<:]]' . $word . '[[:>:]]');
|
||||||
}
|
}
|
||||||
$s .= ($s ? ' AND ' : '') . "$table.$field RLIKE $bindKey";
|
$s .= ($s ? ' AND ' : '') . "$table.$field RLIKE $bindKey";
|
||||||
|
Reference in New Issue
Block a user