Skip to content

Commit 79464cd

Browse files
authored
Update ImapProtocol.php (#233)
This prevents from erase already parsed tokens.
1 parent 0ddfbdd commit 79464cd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Connection/Protocols/ImapProtocol.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ public function fetch($items, $from, $to = null, $uid = IMAP::ST_UID) {
616616
if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] != $from : $tokens[0] != $from)) {
617617
continue;
618618
}
619-
$data = "";
620619

621620
// if we only want one item we return that one directly
622621
if (count($items) == 1) {
@@ -625,6 +624,7 @@ public function fetch($items, $from, $to = null, $uid = IMAP::ST_UID) {
625624
} elseif ($uid && $tokens[2][2] == $items[0]) {
626625
$data = $tokens[2][3];
627626
} else {
627+
$expectedResponse = 0;
628628
// maybe the server send an other field we didn't wanted
629629
$count = count($tokens[2]);
630630
// we start with 2, because 0 was already checked
@@ -633,8 +633,12 @@ public function fetch($items, $from, $to = null, $uid = IMAP::ST_UID) {
633633
continue;
634634
}
635635
$data = $tokens[2][$i + 1];
636+
$expectedResponse = 1;
636637
break;
637638
}
639+
if (!$expectedResponse) {
640+
continue;
641+
}
638642
}
639643
} else {
640644
$data = [];

0 commit comments

Comments
 (0)