From 0ead73bbd7c3eafcef42563df33443c7093046f2 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..0fdb75a 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() + { + if ($this->connection) { + @ftp_close($this->connection); // @ may fail + } + } + + /** * Connects to FTP server. * @throws ServerException