Explicitly handle `fgets()` returning `false` in SmtpEmailTransport
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 9 Sep 2022 08:16:02 +0000 (10:16 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 9 Sep 2022 09:39:17 +0000 (11:39 +0200)
(cherry picked from commit a6ed0b255968e9ef44c6e37f7eb71fa4ad5256ea)

wcfsetup/install/files/lib/system/email/transport/SmtpEmailTransport.class.php

index 1cfe0d39e2184361d53ab36c3a57cf0e0acdb1dd..e64735c6a9a0afdb59925ef0a9a121d22b36f338 100644 (file)
@@ -218,6 +218,9 @@ class SmtpEmailTransport implements IStatusReportingEmailTransport
                 if ($this->connection->eof()) {
                     throw new TransientFailure("Unexpected EOF / connection close from SMTP server.");
                 }
+                if ($data === false) {
+                    throw new TransientFailure("Failed to read from SMTP server.");
+                }
 
                 throw new TransientFailure("Unexpected reply '" . $data . "' from SMTP server.");
             }