Skip to content

Commit a11db0a

Browse files
committed
Clear Imap Errors
Clear imap errors. If do not clear then imap errors are shown at the end of php script execution even if we tried to catch all exceptions.
1 parent a0f3323 commit a11db0a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PhpImap/Mailbox.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ public function getImapStream($forceConnection = true) {
7373
protected function initImapStream() {
7474
$imapStream = @imap_open($this->imapPath, $this->imapLogin, $this->imapPassword, $this->imapOptions, $this->imapRetriesNum, $this->imapParams);
7575
if(!$imapStream) {
76-
throw new Exception('Connection error: ' . imap_last_error());
76+
$lastError = imap_last_error();
77+
imap_errors();
78+
throw new Exception('Connection error: ' . $lastError);
7779
}
7880
return $imapStream;
7981
}

0 commit comments

Comments
 (0)