From ed18c7ce46663eb4e5b20ed15d8c18c2a9348ec3 Mon Sep 17 00:00:00 2001 From: skmedix Date: Tue, 7 Jan 2025 20:44:28 +0100 Subject: [PATCH] [Mailer] Fix SMTP stream EOF handling on Windows by using feof() --- .../Mailer/Transport/Smtp/Stream/AbstractStream.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php index 498dc560c3ede..55a2594ac1de5 100644 --- a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php +++ b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php @@ -80,11 +80,10 @@ public function readLine(): string $line = @fgets($this->out); if ('' === $line || false === $line) { - $metas = stream_get_meta_data($this->out); - if ($metas['timed_out']) { + if (stream_get_meta_data($this->out)['timed_out']) { throw new TransportException(sprintf('Connection to "%s" timed out.', $this->getReadConnectionDescription())); } - if ($metas['eof']) { + if (feof($this->out)) { // don't use "eof" metadata, it's not accurate on Windows throw new TransportException(sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription())); } if (false === $line) {