Open
Description
ErrorException/src/Mail/ImapManager.php in App\Mail\ImapManager::connect
Warning: imap_open(): Couldn't open stream {mail.foo-bar.de:993/ssl/novalidate-cert}
Hi,. the following code results in a warning before using \Safe\imap_open
:
$stream = imap_open(
sprintf('{%s:%d/ssl/novalidate-cert}', $this->host, $this->port),
$this->username,
$this->password,
0,
1,
['DISABLE_AUTHENTICATOR' => 'GSSAPI']
);
now the reworked code with using \Safe\imap_open
:
try {
$stream = imap_open(
sprintf('{%s:%d/ssl/novalidate-cert}', $this->host, $this->port),
$this->username,
$this->password,
0,
1,
['DISABLE_AUTHENTICATOR' => 'GSSAPI']
);
} catch (Exceptions\ImapException $exception) {
throw new \Exception(
sprintf('Cannot connect to %s on port %d with username %s: %s',
$this->host,
$this->port,
$this->username,
imap_last_error()
)
);
}
results with the error above where its only a warning.
Is there a best pracitse on how to handle such warnings, which are now exceptions? 🤔
cc @localheinz
Metadata
Metadata
Assignees
Labels
No labels