Skip to content

Commit

Permalink
Fix for failed call to Laminas\Mail\Storage\Imap->close() on invalid …
Browse files Browse the repository at this point in the history
…server response

Signed-off-by: Pascal Eyacher <[email protected]>
  • Loading branch information
PEyacher committed Aug 29, 2024
1 parent 6d1c33d commit 460d06c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Protocol/Imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ protected function nextTaggedLine(&$tag)
{
$line = $this->nextLine();

if (! str_contains($line, ' ')) {
throw new Exception\RuntimeException('Invalid response line received: ' . $line);
}

// separate tag from line
[$tag, $line] = explode(' ', $line, 2);

Expand Down Expand Up @@ -445,9 +449,10 @@ public function logout()
$result = $this->requestAndResponse('LOGOUT', [], true);
} catch (Exception\ExceptionInterface) {
// ignoring exception
} finally {
fclose($this->socket);
$this->socket = null;
}
fclose($this->socket);
$this->socket = null;
}
return $result;
}
Expand Down

0 comments on commit 460d06c

Please sign in to comment.