Fixed issue if search keywords are longer than 191 chars
authorMarcel Werk <burntime@woltlab.com>
Fri, 30 Nov 2018 15:54:56 +0000 (16:54 +0100)
committerMarcel Werk <burntime@woltlab.com>
Fri, 30 Nov 2018 15:54:56 +0000 (16:54 +0100)
wcfsetup/install/files/lib/system/search/SearchKeywordManager.class.php

index e168441fd2fe71b4aae897b57cb93214cf753c46..d013f3c7d145d7000389ffc3f1a6ac1431e1b6e3 100644 (file)
@@ -20,6 +20,8 @@ class SearchKeywordManager extends SingletonFactory {
         * @param       string          $keyword
         */
        public function add($keyword) {
+               $keyword = mb_substr($keyword, 0, 191);
+               
                // search existing entry
                $sql = "SELECT  *
                        FROM    wcf".WCF_N."_search_keyword
@@ -35,7 +37,7 @@ class SearchKeywordManager extends SingletonFactory {
                }
                else {
                        $action = new SearchKeywordAction([], 'create', ['data' => [
-                               'keyword' => mb_substr($keyword, 0, 191),
+                               'keyword' => $keyword,
                                'searches' => 1,
                                'lastSearchTime' => TIME_NOW
                        ]]);