From 18757405d5649551c82795efb4a44b1b44858205 Mon Sep 17 00:00:00 2001 From: Sascha Egerer Date: Mon, 15 Aug 2022 10:01:00 +0200 Subject: [PATCH] Ensure keywords string does not exceed database field length The keywords field of the statistics database is only 128 characters long. If a search keyword with more than 128 chars is used, the database insert fails if statistics are enabled. Fixes: #3321 Ports: #3322 --- Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php b/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php index 7fa44232b9..c352d303b7 100644 --- a/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php +++ b/Classes/Domain/Search/Statistics/StatisticsWriterProcessor.php @@ -123,6 +123,8 @@ protected function getProcessedKeywords( ): string { $keywords = $query->getQuery(); $keywords = $this->sanitizeString($keywords); + // Ensure string does not exceed database field length + $keywords = substr($keywords, 0, 128); if ($lowerCaseQuery) { $keywords = mb_strtolower($keywords); }