From c0c5340f4eebe790d6193cca46bc48fe7ce79f6d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 1 Jun 2021 09:15:34 +0200 Subject: [PATCH] Fix populating the array and closing the cursors Signed-off-by: Joas Schilling --- lib/private/Comments/Manager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 8cd8fc57b3..beaab9535a 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -655,16 +655,16 @@ class Manager implements ICommentsManager { $query->andWhere($query->expr()->eq('c.verb', $query->createNamedParameter($verb))); } + $unreadComments = array_fill_keys($objectIds, 0); foreach (array_chunk($objectIds, 1000) as $chunk) { $query->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY); - $result = $query->execute(); - $unreadComments += array_fill_keys($objectIds, 0); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $unreadComments[$row['object_id']] = (int) $row['num_comments']; } + $result->closeCursor(); } - $result->closeCursor(); return $unreadComments; }