From f47133ff57e619effbc1e71cc1d1a065fbcb75d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 12 May 2022 14:48:06 +0200 Subject: [PATCH] Fix incorrect use of `mb_strpos` in MysqlSearchEngine The return value of `mb_strpos` needs to be checked type-safely, as both `0` and `false` are falsy. In this case this likely was safe, as the inner join may not appear at the start of the query, it was a questionable nonetheless. Fix this by using `str_contains()` which makes the intent even clearer. --- .../files/lib/system/search/mysql/MysqlSearchEngine.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php index 91e3677540..40a5208096 100644 --- a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php +++ b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php @@ -85,7 +85,7 @@ class MysqlSearchEngine extends AbstractSearchEngine " . ($additionalConditions[$objectTypeName] ?? ''); } - if (\mb_strpos($query, '{WCF_SEARCH_INNER_JOIN}')) { + if (\str_contains($query, '{WCF_SEARCH_INNER_JOIN}')) { $innerJoin = $this->getInnerJoin( $objectTypeName, $q, -- 2.20.1