From e876408c16a0f046f8a2cf61f3fe1b480bdf9ec5 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Thu, 3 Aug 2023 16:34:56 +0200 Subject: [PATCH] fix: close cursor after reading the invitation Signed-off-by: Daniel Kesselberg --- apps/dav/lib/Controller/InvitationResponseController.php | 3 ++- .../unit/Controller/InvitationResponseControllerTest.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index a360794987413..b6013d7b5ad70 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -166,8 +166,9 @@ private function getTokenInformation(string $token) { $query->select('*') ->from('calendar_invitations') ->where($query->expr()->eq('token', $query->createNamedParameter($token))); - $stmt = $query->execute(); + $stmt = $query->executeQuery(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); + $stmt->closeCursor(); if (!$row) { return null; diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php index aac79844aacac..2d9132ddccb6d 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -465,6 +465,8 @@ private function buildQueryExpects($token, $return, $time): void { ->method('fetch') ->with(\PDO::FETCH_ASSOC) ->willReturn($return); + $stmt->expects($this->once()) + ->method('closeCursor'); $function = 'functionToken'; $expr->expects($this->once()) @@ -490,7 +492,7 @@ private function buildQueryExpects($token, $return, $time): void { ->with($function) ->willReturn($queryBuilder); $queryBuilder->expects($this->once()) - ->method('execute') + ->method('executeQuery') ->with() ->willReturn($stmt);