php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78374 PHP Warning returned when closing FTPS connection after FTP_PUT
Submitted: 2019-08-05 15:53 UTC Modified: 2021-09-07 09:01 UTC
Votes:5
Avg. Score:3.4 ± 1.0
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: WebDevDLo at gmail dot com Assigned:
Status: Verified Package: FTP related
PHP Version: 7.4 OS: CentOS 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: WebDevDLo at gmail dot com
New email:
PHP Version: OS:

 

 [2019-08-05 15:53 UTC] 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"

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-12 11:32 UTC] cmb@php.net
-Status: Open +Status: Verified -PHP Version: 7.3.8 +PHP Version: 7.4 -Assigned To: +Assigned To: cmb
 [2021-08-12 11:32 UTC] cmb@php.net
I can reproduce this with PHP-7.4 with IIS.
 [2021-08-12 11:32 UTC] cmb@php.net
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
 [2021-09-07 09:01 UTC] cmb@php.net
-Assigned To: cmb +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC