Skip to content

Commit 412b545

Browse files
committed
Clear current token properly
1 parent 7137357 commit 412b545

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Connection/ImapParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected function parseUntaggedResponse(): UntaggedResponse
104104

105105
// If the end-of-response marker (CRLF) is present, consume it.
106106
if ($this->currentToken && $this->isEndOfResponseToken($this->currentToken)) {
107-
$this->advance();
107+
$this->currentToken = null;
108108
} else {
109109
throw new ImapParseException('Unterminated untagged response');
110110
}
@@ -133,7 +133,7 @@ protected function parseContinuationResponse(): ContinuationResponse
133133

134134
// Consume the CRLF marker if present.
135135
if ($this->currentToken && $this->isEndOfResponseToken($this->currentToken)) {
136-
$this->advance();
136+
$this->currentToken = null;
137137
} else {
138138
throw new ImapParseException('Unterminated continuation response');
139139
}
@@ -160,7 +160,7 @@ protected function parseTaggedResponse(): TaggedResponse
160160

161161
// Consume the CRLF marker if present.
162162
if ($this->currentToken && $this->isEndOfResponseToken($this->currentToken)) {
163-
$this->advance();
163+
$this->currentToken = null;
164164
} else {
165165
throw new ImapParseException('Unterminated tagged response');
166166
}

src/Connection/ImapStream.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public function open(string $transport, string $host, int $port, int $timeout, a
3131
throw new ConnectionFailedException('Stream failed to open: '.$errstr, $errno);
3232
}
3333

34+
stream_set_blocking($this->stream, true);
35+
3436
return true;
3537
}
3638

0 commit comments

Comments
 (0)