From ab838fb73bdb1b56cf761111af9a19a6b47d7060 Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Wed, 26 Apr 2023 09:05:30 +0200
Subject: [PATCH] [BUGFIX] Harmonize page ids in Record List search

The list of ids generated by `getSearchableWebmounts()` may contain
duplicated values being passed into an `IN()` criteria, causing
additional load to the database server.

The values are now de-duplicated by applying `array_unique()` onto the
list before passing the list around.

Resolves: #100750
Releases: main, 11.5
Change-Id: Ib49bf1a5903cca2fbaa12ea240050caa7908f69c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78874
Tested-by: core-ci <typo3@b13.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
---
 .../sysext/recordlist/Classes/RecordList/DatabaseRecordList.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
index 5437b8e430c6..1136c8a486ee 100644
--- a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
+++ b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
@@ -3010,7 +3010,7 @@ class DatabaseRecordList
                 }
                 $idList = array_merge($idList, $tree->ids);
             }
-            $runtimeCache->set($hash, $idList);
+            $runtimeCache->set($hash, array_unique($idList));
         }
 
         return $idList;
-- 
GitLab