php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80880 SSL_read on shutdown, ftp/proc_open
Submitted: 2021-03-18 02:19 UTC Modified: 2021-03-24 13:31 UTC
From: gajowy at agzeta dot pl Assigned: cmb (profile)
Status: Closed Package: FTP related
PHP Version: 8.0.3 OS: Windows 10 64-bit
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: gajowy at agzeta dot pl
New email:
PHP Version: OS:

 

 [2021-03-18 02:19 UTC] gajowy at agzeta dot pl
Description:
------------
Description:
------------
SSL_read on shutdown: No such file or directory (2) or
(main): SSL_read on shutdown: Invalid argument (22)
warining messages are issued if ftp code is executed after proc_open.

Error is trigerred even if ftp-related code is run succesfully (ftp_open, ftp_login, ftp_put & ftp_close).

Another strange thing is that the problem only occurs if proc_open has been run beforehand.

1. If ftp code is inside a function (test script 1):
warning message is issued when return to the parent function.

2. If ftp code is inside the main() function (test script 2):
warining message is issued when script execution terminates.

Test script:
---------------
Test script 1
-------------
dl('ftp');
proc_open('php.exe',[],$pipes,NULL,NULL,['bypass_shell'=>TRUE]);
Send();
print("Last script line is here.\n");

function Send()
{
// replace ftp_server, user, password with actual values
$ftp=ftp_ssl_connect(ftp_server,21,10);
ftp_login($ftp, user, password);
ftp_close($ftp);
}

Test script 2
-------------
dl('ftp');
proc_open('php.exe',[],$pipes,NULL,NULL,['bypass_shell'=>TRUE]);
// replace ftp_server, user, password with actual values
$ftp=ftp_ssl_connect(ftp_server,21,10);
ftp_login($ftp, user, password);
ftp_close($ftp);
print("Last script line is here.\n");

Expected result:
----------------
No warning message is issued.

Actual result:
--------------
Various message warnings issued, like:
SSL_read on shutdown: No such file or directory (2)
(main): SSL_read on shutdown: Invalid argument (22)

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-24 13:31 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-03-24 13:31 UTC] cmb@php.net
I can confirm the spurious warning regardless of a proc_open()
with PHP-7.4 and IIS.  It seems to me the SSL shutdown handling[1]
is missing a case for SSL_ERROR_SYSCALL.  errno 2 and 22 appear to
correspond to WSAECONNABORTED.

[1] <https://github.com/php/php-src/blob/php-7.4.16/ext/ftp/ftp.c#L1920-L1943>
 [2021-03-24 13:49 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #80880: SSL_read on shutdown, ftp/proc_open
On GitHub:  https://github.com/php/php-src/pull/6803
Patch:      https://github.com/php/php-src/pull/6803.patch
 [2021-04-06 12:09 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/php-src/commit/9688071679a7084c82716aa1275b8965590ea759
Log: Fix #80880: SSL_read on shutdown, ftp/proc_open
 [2021-04-06 12:09 UTC] git@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 09:01:28 2024 UTC