From:             webmaster at wiedmann-online dot de
Operating system: Windows_NT
PHP version:      5.2.1
PHP Bug Type:     FTP related
Bug description:  Problems with the ftps wrapper.

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:[EMAIL PROTECTED]: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:[EMAIL 
PROTECTED]: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://[EMAIL PROTECTED]: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


-- 
Edit bug report at http://bugs.php.net/?id=41021&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41021&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41021&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41021&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41021&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41021&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41021&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41021&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41021&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41021&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41021&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41021&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41021&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41021&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41021&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41021&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41021&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41021&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41021&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41021&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41021&r=mysqlcfg

Reply via email to