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

Skip to content

Commit b49f580

Browse files
committed
[Mailer] Thrown TransportException when unable to read from socket
1 parent 0cd0c49 commit b49f580

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
@@ -77,7 +77,7 @@ public function readLine(): string
7777
return '';
7878
}
7979

80-
$line = fgets($this->out);
80+
$line = @fgets($this->out);
8181
if ('' === $line || false === $line) {
8282
$metas = stream_get_meta_data($this->out);
8383
if ($metas['timed_out']) {
@@ -86,6 +86,9 @@ public function readLine(): string
8686
if ($metas['eof']) {
8787
throw new TransportException(sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription()));
8888
}
89+
if (false === $line) {
90+
throw new TransportException(sprintf('Unable to read from connection to "%s".', $this->getReadConnectionDescription()));
91+
}
8992
}
9093

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

0 commit comments

Comments
 (0)