Skip to content

Commit

Permalink
PHP IMAP: Only explode the tag line if it contains a space - closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Nov 8, 2023
1 parent e9b66ff commit 63e2384
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ protected function assumedNextLine(string $start): bool {
*/
protected function nextTaggedLine(&$tag): string {
$line = $this->nextLine();
list($tag, $line) = explode(' ', $line, 2);
if (str_contains($line, ' ')) {
list($tag, $line) = explode(' ', $line, 2);
}

return $line ?? '';
}
Expand Down Expand Up @@ -282,7 +284,7 @@ public function readResponse(string $tag, bool $dontParse = false) {
// last line has response code
if ($tokens[0] == 'OK') {
return $lines ? $lines : true;
} elseif ($tokens[0] == 'NO') {
} elseif ($tokens[0] == 'NO' || $tokens[0] == 'BAD' || $tokens[0] == 'BYE') {
return false;
}

Expand Down

0 comments on commit 63e2384

Please sign in to comment.