10000 [Mailer] Fix SMTP stream EOF handling on Windows by using feof() · symfony/symfony@ed18c7c · GitHub
[go: up one dir, main page]

Skip to content

Commit ed18c7c

Browse files
skmedixnicolas-grekas
authored andcommitted
[Mailer] Fix SMTP stream EOF handling on Windows by using feof()
1 parent 86b9250 commit ed18c7c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ public function readLine(): string
8080

8181
$line = @fgets($this->out);
8282
if ('' === $line || false === $line) {
83-
$metas = stream_get_meta_data($this->out);
84-
if ($metas['timed_out']) {
83+
if (stream_get_meta_data($this->out)['timed_out']) {
8584
throw new TransportException(sprintf('Connection to "%s" timed out.', $this->getReadConnectionDescription()));
8685
}
87-
if ($metas['eof']) {
86+
if (feof($this->out)) { // don't use "eof" metadata, it's not accurate on Windows
8887
throw new TransportException(sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription()));
8988
}
9089
if (false === $line) {

0 commit comments

Comments
 (0)
0