diff --git a/Transport/Smtp/Stream/AbstractStream.php b/Transport/Smtp/Stream/AbstractStream.php index 884e6e1..501a618 100644 --- a/Transport/Smtp/Stream/AbstractStream.php +++ b/Transport/Smtp/Stream/AbstractStream.php @@ -88,7 +88,13 @@ public function readLine(): string throw new TransportException(\sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription())); } if (false === $line) { - throw new TransportException(\sprintf('Unable to read from connection to "%s": ', $this->getReadConnectionDescription()).error_get_last()['message']); + if ($this->getReadConnectionDescription() && error_get_last()){ + $error = $this->getReadConnectionDescription().error_get_last()['message']; + } + else{ + $error = $this->getReadConnectionDescription().error_get_last(); + } + throw new TransportException(sprintf('Unable to read from connection to "%s": ', $error)); } }