From 998bf34b5c6f36d46c5e96237a79b77d9a09c737 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 5 Oct 2023 16:26:10 +0200 Subject: [PATCH] fix(sync): return if headers couldn't be parsed Signed-off-by: Anna Larch --- lib/IMAP/ImapMessageFetcher.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/IMAP/ImapMessageFetcher.php b/lib/IMAP/ImapMessageFetcher.php index 4d38dd2f79..e2e7dd1b3a 100644 --- a/lib/IMAP/ImapMessageFetcher.php +++ b/lib/IMAP/ImapMessageFetcher.php @@ -34,7 +34,6 @@ use Horde_Imap_Client_Fetch_Query; use Horde_Imap_Client_Ids; use Horde_ListHeaders; -use Horde_ListHeaders_Base; use Horde_Mime_Exception; use Horde_Mime_Headers; use Horde_Mime_Part; @@ -523,8 +522,11 @@ private function parseHeaders(Horde_Imap_Client_Data_Fetch $fetch): void { $listUnsubscribeHeader = $parsedHeaders->getHeader('list-unsubscribe'); if ($listUnsubscribeHeader !== null) { $listHeaders = new Horde_ListHeaders(); - /** @var Horde_ListHeaders_Base[] $headers */ $headers = $listHeaders->parse($listUnsubscribeHeader->name, $listUnsubscribeHeader->value_single); + if (!$headers) { + // Unable to parse headers + return; + } foreach ($headers as $header) { if (str_starts_with($header->url, 'http')) { $this->unsubscribeUrl = $header->url;