diff --git a/src/Connection/Protocols/ImapProtocol.php b/src/Connection/Protocols/ImapProtocol.php index a8476b0d..6bbc3bc5 100644 --- a/src/Connection/Protocols/ImapProtocol.php +++ b/src/Connection/Protocols/ImapProtocol.php @@ -105,7 +105,7 @@ protected function enableStartTls(){ */ public function nextLine(): string { $line = ""; - while (($next_char = fread($this->stream, 1)) !== false && $next_char !== "\n") { + while (($next_char = fread($this->stream, 1)) !== false && !in_array($next_char, ["","\n"])) { $line .= $next_char; } if ($line === "" && $next_char === false) { @@ -137,7 +137,7 @@ protected function nextTaggedLine(&$tag): string { $line = $this->nextLine(); list($tag, $line) = explode(' ', $line, 2); - return $line; + return $line ?? ''; } /**