From 8cb8a180b775a5d6e276e61f6bedef905eb8bd8d Mon Sep 17 00:00:00 2001 From: FreeScout Date: Fri, 27 Sep 2024 06:58:39 -0700 Subject: [PATCH] Fix null given error in getMessageNumber() - closes #4257 --- .../php-imap/src/Connection/Protocols/ImapProtocol.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php b/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php index 69bba0730..fc1e41499 100644 --- a/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php +++ b/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php @@ -790,9 +790,11 @@ public function getUid($id = null) { */ public function getMessageNumber(string $id): int { $ids = $this->getUid(); - foreach ($ids as $k => $v) { - if ($v == $id) { - return (int)$k; + if ($ids) { + foreach ($ids as $k => $v) { + if ($v == $id) { + return (int)$k; + } } }