diff --git a/classes/announcement/Collector.php b/classes/announcement/Collector.php index 895d477e9b1..2f6d7e38915 100644 --- a/classes/announcement/Collector.php +++ b/classes/announcement/Collector.php @@ -193,12 +193,12 @@ public function getQueryBuilder(): Builder $qb->whereIn('a.announcement_id', function (Builder $q) use ($words) { $q->select('announcement_id')->from($this->dao->settingsTable); foreach ($words as $word) { - $word = strtolower(addcslashes($word, '%_')); + $word = addcslashes($word, '%_'); $q->where( fn (Builder $q) => $q - ->where(fn (Builder $q) => $q->where('setting_name', 'title')->where(DB::raw('lower(setting_value)'), 'LIKE', "%{$word}%")) - ->orWhere(fn (Builder $q) => $q->where('setting_name', 'descriptionShort')->where(DB::raw('lower(setting_value)'), 'LIKE', "%{$word}%")) - ->orWhere(fn (Builder $q) => $q->where('setting_name', 'description')->where(DB::raw('lower(setting_value)'), 'LIKE', "%{$word}%")) + ->where(fn (Builder $q) => $q->where('setting_name', 'title')->whereRaw('LOWER(setting_value) LIKE ?', ["%{$word}%"])) + ->orWhere(fn (Builder $q) => $q->where('setting_name', 'descriptionShort')->whereRaw('LOWER(setting_value) LIKE ?', ["%{$word}%"])) + ->orWhere(fn (Builder $q) => $q->where('setting_name', 'description')->whereRaw('LOWER(setting_value) LIKE ?', ["%{$word}%"])) ); } });