From 548b6be34e7c7e340c09383219153604493568d8 Mon Sep 17 00:00:00 2001 From: latypoff Date: Tue, 24 May 2022 17:35:32 +0600 Subject: [PATCH] Update ImapProtocol.php This prevents from erase already parsed tokens. --- src/Connection/Protocols/ImapProtocol.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Connection/Protocols/ImapProtocol.php b/src/Connection/Protocols/ImapProtocol.php index b2949033..7c6e3429 100644 --- a/src/Connection/Protocols/ImapProtocol.php +++ b/src/Connection/Protocols/ImapProtocol.php @@ -585,7 +585,6 @@ public function fetch($items, $from, $to = null, $uid = IMAP::ST_UID) { if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] != $from : $tokens[0] != $from)) { continue; } - $data = ""; // if we only want one item we return that one directly if (count($items) == 1) { @@ -594,6 +593,7 @@ public function fetch($items, $from, $to = null, $uid = IMAP::ST_UID) { } elseif ($uid && $tokens[2][2] == $items[0]) { $data = $tokens[2][3]; } else { + $expectedResponse = 0; // maybe the server send an other field we didn't wanted $count = count($tokens[2]); // we start with 2, because 0 was already checked @@ -602,8 +602,12 @@ public function fetch($items, $from, $to = null, $uid = IMAP::ST_UID) { continue; } $data = $tokens[2][$i + 1]; + $expectedResponse = 1; break; } + if (!$expectedResponse) { + continue; + } } } else { $data = [];