Skip to content

Commit c9271a8

Browse files
https://github.com/Webklex/php-imap/issues/291
1 parent a3fcead commit c9271a8

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/Connection/Protocols/ImapProtocol.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,12 @@ protected function enableStartTls(){
110110
* @throws RuntimeException
111111
*/
112112
public function nextLine(): string {
113-
$line = "";
114-
while (($next_char = fread($this->stream, 1)) !== false && $next_char !== "\n") {
115-
$line .= $next_char;
113+
$line = fgets($this->stream);
114+
if ($line === false) {
115+
throw new RuntimeException('no response');
116116
}
117-
if ($line === "" && $next_char === false) {
118-
throw new RuntimeException('empty response');
119-
}
120-
if ($this->debug) echo "<< ".$line."\n";
121-
return $line . "\n";
117+
if ($this->debug) echo "<< ".$line;
118+
return $line;
122119
}
123120

124121
/**

0 commit comments

Comments
 (0)