From 700543c5730a65a69c84a01325fc44e64a719efd Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 24 Jun 2024 13:43:02 +0200 Subject: [PATCH] Changes for #1640 --- .../app/libraries/MailSo/Imap/Traits/Status.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php index 1ad7c8c7a..7627e7ae0 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php @@ -123,6 +123,8 @@ trait Status $value = \is_array($value) ? \reset($value) : $value; if (\is_string($value)) { $this->MAILBOXID = \base64_encode($value); + } else { + \error_log("{$this->FullName} invalid MAILBOXID value"); } } else { $this->$name = (int) $value; @@ -162,12 +164,17 @@ trait Status && isset($oResponse->ResponseList[3]) && \is_array($oResponse->ResponseList[3]) ) { - $c = \count($oResponse->ResponseList[3]); + $c = \count($oResponse->ResponseList[3]) - 1; for ($i = 0; $i < $c; $i += 2) { - $bResult |= $this->setStatusItem( - $oResponse->ResponseList[3][$i], - $oResponse->ResponseList[3][$i+1] - ); + if ($c > $i) { + $bResult |= $this->setStatusItem( + $oResponse->ResponseList[3][$i], + $oResponse->ResponseList[3][$i+1] + ); + } else { + // https://github.com/the-djmaze/snappymail/issues/1640 + \error_log("{$this->FullName} STATUS missing value for {$oResponse->ResponseList[3][$i]}"); + } } $this->hasStatus = $bResult; }