From 378a0f983739bf2a2a2a8202fc4277dea2b84bfa 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 3cf2e658621..0ec630883dc 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -169,8 +169,9 @@ class InvitationResponseController extends Controller { $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 aac79844aac..2d9132ddccb 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -465,6 +465,8 @@ EOF; ->method('fetch') ->with(\PDO::FETCH_ASSOC) ->willReturn($return); + $stmt->expects($this->once()) + ->method('closeCursor'); $function = 'functionToken'; $expr->expects($this->once()) @@ -490,7 +492,7 @@ EOF; ->with($function) ->willReturn($queryBuilder); $queryBuilder->expects($this->once()) - ->method('execute') + ->method('executeQuery') ->with() ->willReturn($stmt);