From 2e81d39275c716c217f812c396a724210a8f57a4 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 11 Sep 2020 14:22:06 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#1240 --- wire/core/PageFinder.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wire/core/PageFinder.php b/wire/core/PageFinder.php index 95b4a194..914de84f 100644 --- a/wire/core/PageFinder.php +++ b/wire/core/PageFinder.php @@ -2504,12 +2504,11 @@ class PageFinder extends Wire { $s = ''; foreach(explode(' ', $value) as $n => $word) { $word = $sanitizer->pageName($word, Sanitizer::toAscii); - $mySQL8 = false; // @todo add version check - if($mySQL8) { - // confirm the statement below works in MySQL 8.x because "\\b" has - // very different regex meaning between 8.x and versions prior to it + if($database->getRegexEngine() === 'ICU') { + // MySQL 8.0.4+ uses ICU regex engine where "\\b" is used for word boundary $bindKey = $query->bindValueGetKey("\\b$word\\b"); } else { + // this Henry Spencer regex engine syntax works only in MySQL 8.0.3 and prior $bindKey = $query->bindValueGetKey('[[:<:]]' . $word . '[[:>:]]'); } $s .= ($s ? ' AND ' : '') . "$table.$field RLIKE $bindKey";