Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 83e4e06

Browse files
committed
[Mailer] Throw TransportException when unable to read from socket
1 parent f689d87 commit 83e4e06

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function readLine(): string
7474
return '';
7575
}
7676

77-
$line = fgets($this->out);
77+
$line = @fgets($this->out);
7878
if ('' === $line || false === $line) {
7979
$metas = stream_get_meta_data($this->out);
8080
if ($metas['timed_out']) {
@@ -83,6 +83,9 @@ public function readLine(): string
8383
if ($metas['eof']) {
8484
throw new TransportException(sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription()));
8585
}
86+
if (false === $line) {
87+
throw new TransportException(sprintf('Unable to read from connection to "%s".', $this->getReadConnectionDescription()));
88+
}
8689
}
8790

8891
$this->debug .= sprintf('< %s', $line);

0 commit comments

Comments
 (0)