Bug #78374 [PATCH]: PHP Warning returned when closing FTPS connection after FTP_PUT

From: Date: Thu, 12 Aug 2021 11:32:35 +0000
Subject: Bug #78374 [PATCH]: PHP Warning returned when closing FTPS connection after FTP_PUT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235791@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78374&edit=1

 ID:                 78374
 Patch added by:     cmb@php.net
 Reported by:        WebDevDLo at gmail dot com
 Summary:            PHP Warning returned when closing FTPS connection
                     after FTP_PUT
 Status:             Verified
 Type:               Bug
 Package:            FTP related
 Operating System:   CentOS 7
 PHP Version:        7.4
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

The following pull request has been associated:

Patch Name: Fix #78374: Warning when closing FTPS connection after FTP_PUT
On GitHub:  https://github.com/php/php-src/pull/7362
Patch:      https://github.com/php/php-src/pull/7362.patch


Previous Comments:
------------------------------------------------------------------------
[2021-08-12 11:32:09] cmb@php.net

I can reproduce this with PHP-7.4 with IIS.

------------------------------------------------------------------------
[2019-08-05 15:53:45] WebDevDLo at gmail dot com

Description:
------------
Using PHP version 7.3.7.

This error is similar to https://bugs.php.net/bug.php?id=77151, but that
has been closed since 2018 and yet multiple comments still report an issue when doing an FTP_PUT.

To reproduce (test script included below) use ftp_ssl_connect to create a connection to an FTPS
server. Set the connection to passive mode. FTP_PUT a file. Close the connection. Bang, you get the
following "PHP Warning:  ftp_close(): SSL_read on shutdown: Connection reset by peer"

One theory, although I have not researched this, is I wonder if there is a difference when using
SFTP vs FTPS. Regardless, the FTPS server is what I have to work with and is still a relevant
protocol.

Appreciate any attention this gets! I don't want to workaround this by ignoring PHP Warnings.
Thank you.

Test script:
---------------
<?php
$conn = ftp_ssl_connect('ftps.host');

            if ($conn) {
                $login_result = ftp_login($conn, 'user', 'pass');
                $set_passive = ftp_pasv($conn, true);
            }
            else {
                throw new Exception('Could not connect to FTP service.');
            }

ftp_chdir($conn, 'stage'); // change directory
ftp_put($conn, 'test.txt', 'test.txt', FTP_ASCII); // put file
ftp_close($conn);


Expected result:
----------------
I expect to see no output.

Actual result:
--------------
PHP returns: "PHP Warning:  ftp_close(): SSL_read on shutdown: Connection reset by peer"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78374&edit=1


Thread (3 messages)

« previous php.bugs (#235791) next »