From 891e63da274e548b523670e4a1f3ff8c66b0f339 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 8 Aug 2024 16:42:42 +0200 Subject: [PATCH] FtpServer: suppress error on closing [Closes #171] --- src/Deployment/FtpServer.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Deployment/FtpServer.php b/src/Deployment/FtpServer.php index d60aa88..2d93251 100644 --- a/src/Deployment/FtpServer.php +++ b/src/Deployment/FtpServer.php @@ -55,6 +55,17 @@ public function __construct( } + /** + * Suppresses error on closing. + */ + public function __destruct(): void + { + if ($this->connection) { + @ftp_close($this->connection); // @ may fail + } + } + + /** * Connects to FTP server. * @throws ServerException