dg / ftp-deployment

A tool for automated deployment of web applications to an FTP server.
https://nette.org
Other
605 stars 89 forks source link

FTP with SSL fails on when #171

Closed arxeiss closed 2 months ago

arxeiss commented 3 months ago

Version: 3.6.1

Bug Description

I'm connecting to server with FTPS. Everything is transferred. But when FTP Server class instance gets deallocated, it closes FTP connection. And on some FTP servers (like Wedos :shrug:) it fails with error below. However this is after all operations are done. So it succeeded but failed in the end.

ErrorException: main(): SSL_read on shutdown: error:0A000126:SSL routines::unexpected eof while reading in phar:///bin/deployment/src/deployment.php:21

When I tried different hosting, I didn't get that error. I'm struggling to get more info what happened wrong. But I don't see anything in logs, or I don't know where exactly to look for it. I can debug it, if I get some instructions how.

Steps To Reproduce

Just try to upload something to Wedos with FTPS.

Expected Behavior

Succeed successfuly.

Possible Solution

When I did this modification to FtpServer.php, it works well. Because it is just warning, but changed into Exception by the rest of the code.

/**
 * FTP server.
 */
class FtpServer implements Server
{
    ...

    function __destruct()
    {
        if ($this->connection) {
            @ftp_close($this->connection); // @ may fail
        }
    }