From 9bbbd1119119d6f360954af7a37166b8f1f1f806 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 21 Jul 2025 11:24:16 +0200 Subject: [PATCH] fix(imip): group messages by logging principal and uri as context Signed-off-by: Daniel Kesselberg --- lib/private/Calendar/Manager.php | 10 ++++++++-- tests/lib/Calendar/ManagerTest.php | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index 0e2a3f5f6797d..7da1379809d0a 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -403,7 +403,10 @@ public function handleIMipReply( } if (empty($found)) { - $this->logger->warning('iMip message event could not be processed because no corresponding event was found in any calendar ' . $principalUri . 'and UID' . $vEvent->{'UID'}->getValue()); + $this->logger->warning('iMip message event could not be processed because no corresponding event was found in any calendar', [ + 'principalUri' => $principalUri, + 'eventUid' => $vEvent->{'UID'}->getValue(), + ]); return false; } @@ -518,7 +521,10 @@ public function handleIMipCancel( } if (empty($found)) { - $this->logger->warning('iMip message event could not be processed because no corresponding event was found in any calendar ' . $principalUri . 'and UID' . $vEvent->{'UID'}->getValue()); + $this->logger->warning('iMip message event could not be processed because no corresponding event was found in any calendar', [ + 'principalUri' => $principalUri, + 'eventUid' => $vEvent->{'UID'}->getValue(), + ]); return false; } diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index fec2cfa0efe3a..eeaca0dfeb630 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -1075,7 +1075,7 @@ public function testHandleImipReplyEventNotFound(): void { $calendarData->add('METHOD', 'REPLY'); // construct logger return $this->logger->expects(self::once())->method('warning') - ->with('iMip message event could not be processed because no corresponding event was found in any calendar ' . $principalUri . 'and UID' . $calendarData->VEVENT->UID->getValue()); + ->with('iMip message event could not be processed because no corresponding event was found in any calendar', ['principalUri' => $principalUri, 'eventUid' => $calendarData->VEVENT->UID->getValue()]); // Act $result = $manager->handleIMipReply($principalUri, $sender, $recipient, $calendarData->serialize()); // Assert @@ -1523,7 +1523,7 @@ public function testHandleImipCancelEventNotFound(): void { $calendarData->add('METHOD', 'CANCEL'); // construct logger return $this->logger->expects(self::once())->method('warning') - ->with('iMip message event could not be processed because no corresponding event was found in any calendar ' . $principalUri . 'and UID' . $calendarData->VEVENT->UID->getValue()); + ->with('iMip message event could not be processed because no corresponding event was found in any calendar', ['principalUri' => $principalUri, 'eventUid' => $calendarData->VEVENT->UID->getValue()]); // Act $result = $manager->handleIMipCancel($principalUri, $sender, $replyTo, $recipient, $calendarData->serialize()); // Assert