1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 01:34:31 +02:00
This commit is contained in:
Ryan Cramer
2020-09-11 14:22:06 -04:00
parent f26ee062b7
commit 2e81d39275

View File

@@ -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";