php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41021 Problems with the ftps wrapper.
Submitted: 2007-04-08 03:47 UTC Modified: 2016-07-23 12:08 UTC
Votes:8
Avg. Score:4.4 ± 0.7
Reproduced:7 of 8 (87.5%)
Same Version:2 (28.6%)
Same OS:2 (28.6%)
From: webmaster at wiedmann-online dot de Assigned: pollita (profile)
Status: Closed Package: FTP related
PHP Version: 5.2.1 OS: Windows_NT
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webmaster at wiedmann-online dot de
New email:
PHP Version: OS:

 

 [2007-04-08 03:47 UTC] webmaster at wiedmann-online dot de
Description:
------------
I've played with the ftps wrapper, but some issues with it.

- scandir() doesn't work at all. (test 1)
- With file_get_contents() I get the content, but also a warning. (test 2)
(the same behaviour I have with an older PHP (5.0.4) on *nix with both tests)

- An additional test with ftp_ssl_connect() works only on *nix (PHP 5.0.4) but not on Windows (PHP 5.1.4, not an official build). (test 3)

With some other ftp clients, I have no problems.


Reproduce code:
---------------
*** TEST 1 ***
[php script]
<?php
error_reporting(E_ALL);
print_r(scandir('ftps://foo:bar@bsdserver-1-node3:21/'));
?> 


*** TEST 2 ***
[explorer.bat (file on ftp server)]
cd \
cd Windows
explorer.exe
pause

[php script]
<?php
error_reporting(E_ALL);
print_r(file_get_contents('ftps://foo:bar@bsdserver-1-node3:21/anonymous/tmp/explorer.bat'));
?>


*** TEST 3 ***
[php script]
<?php
error_reporting(E_ALL);
$conn_id = ftp_ssl_connect('bsdserver-1-node3', 21);
$login_result = ftp_login($conn_id, 'foo', 'bar');
$contents = ftp_nlist($conn_id, '/');
var_dump($contents);
?> 


Expected result:
----------------
It should work (and without warnings) ;-)

But I have logs with working connections from a ftp client (connect / list directory / disconnect) on the same windows box as PHP:

[FTP over TLS explicit / ftp server log]
Apr 07 21:07:30 mod_tls/2.0.7[39949]: TLS/TLS-C requested, starting TLS handshake
Apr 07 21:07:32 mod_tls/2.0.7[39949]: TLSv1/SSLv3 connection accepted, using cipher DHE-RSA-AES256-SHA (256 bits)
Apr 07 21:07:33 mod_tls/2.0.7[39949]: Protection set to Private
Apr 07 21:07:33 mod_tls/2.0.7[39949]: starting TLS negotiation on data connection
Apr 07 21:07:33 mod_tls/2.0.7[39949]: TLSv1/SSLv3 data connection accepted, using cipher DHE-RSA-AES256-SHA (256 bits)


[FTP over SSL explicit / ftp server log]
Apr 07 21:04:14 mod_tls/2.0.7[39934]: SSL/TLS-P requested, starting TLS handshake
Apr 07 21:04:16 mod_tls/2.0.7[39934]: TLSv1/SSLv3 connection accepted, using cipher DHE-RSA-AES256-SHA (256 bits)
Apr 07 21:04:17 mod_tls/2.0.7[39934]: Protection set to Private
Apr 07 21:04:17 mod_tls/2.0.7[39934]: starting TLS negotiation on data connection
Apr 07 21:04:18 mod_tls/2.0.7[39934]: TLSv1/SSLv3 data connection accepted, using cipher DHE-RSA-AES256-SHA (256 bits)


Actual result:
--------------
*** TEST 1 ***
[cli output]
c:\php-5.2.1>php test.php
Warning: scandir(): SSL/TLS already set-up for this stream in c:\php-5.2.1\test.php on line 3
Warning: scandir(ftps://...@bsdserver-1-node1:21/): failed to open dir: Unable to activate SSL mode
FTP server reports 150 Opening ASCII mode data connection for file list in c:\php-5.2.1\test.php on line 3
Warning: scandir(): (errno 11): Resource temporarily unavailable in c:\php-5.2.1\test.php on line 3

[ftp server log]
Apr 07 20:51:36 mod_tls/2.0.7[39797]: TLS/TLS-C requested, starting TLS handshake
Apr 07 20:51:38 mod_tls/2.0.7[39797]: TLSv1/SSLv3 connection accepted, using cipher DHE-RSA-AES256-SHA (256 bits)
Apr 07 20:51:38 mod_tls/2.0.7[39797]: Protection set to Private
Apr 07 20:51:38 mod_tls/2.0.7[39797]: starting TLS negotiation on data connection
Apr 07 20:51:38 mod_tls/2.0.7[39797]: unable to accept TLS connection: received EOF that violates protocol
Apr 07 20:51:38 mod_tls/2.0.7[39797]: unable to open data connection: TLS negotiation failed


*** TEST 2 ***
[cli output]
c:\php-5.2.1>php test.php
Warning: file_get_contents(): SSL: fatal protocol error in c:\php-5.2.1\test.php on line 3
cd \
cd Windows
explorer.exe
pause

[ftp server log]
Apr 07 20:55:48 mod_tls/2.0.7[39867]: TLS/TLS-C requested, starting TLS handshake
Apr 07 20:55:50 mod_tls/2.0.7[39867]: TLSv1/SSLv3 connection accepted, using cipher DHE-RSA-AES256-SHA (256 bits)
Apr 07 20:55:50 mod_tls/2.0.7[39867]: Protection set to Private
Apr 07 20:55:50 mod_tls/2.0.7[39867]: starting TLS negotiation on data connection
Apr 07 20:55:51 mod_tls/2.0.7[39867]: TLSv1/SSLv3 data connection accepted, using cipher DHE-RSA-AES256-SHA (256 bits)
Apr 07 20:55:51 mod_tls/2.0.7[39867]: unexpected OpenSSL error, disconnecting


*** TEST 3 ***
[cli output]
c:\php-5.1.4>php test.php
Warning: ftp_login(): SSL/TLS handshake failed in c:\php-5.1.4\test.php on line 4
Warning: ftp_login(): AUTH TLS successful in c:\php-5.1.4\test.php on line 4
bool(false)

[ftp server log]
Apr 08 04:06:50 mod_tls/2.0.7[43479]: TLS/TLS-C requested, starting TLS handshake
Apr 08 04:06:52 mod_tls/2.0.7[43479]: unable to accept TLS connection:
  (1) error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
Apr 08 04:06:52 mod_tls/2.0.7[43479]: TLS/TLS-C negotiation failed on control channel


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-09 07:34 UTC] tony2001@php.net
Sara, could you plz take a look at this?
 [2008-07-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2016-07-21 09:49 UTC] vhu at iki dot fi
I was able to reproduce Test 1 (issue with scandir()) with 5.6.13 as well as and today's php-src/master from github.

Problem with scandir() is fixed with the same patch as opendir() problem listed in bug #54431.
 [2016-07-23 12:08 UTC] nikic@php.net
-Status: No Feedback +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC