Bug #54431 [Opn]: opendir() does not work with ftps:// wrapper

From: Date: Thu, 31 Mar 2011 12:00:33 +0000
Subject: Bug #54431 [Opn]: opendir() does not work with ftps:// wrapper
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159873@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54431&edit=1

 ID:                 54431
 User updated by:    chrisw at networkm dot co dot uk
 Reported by:        chrisw at networkm dot co dot uk
 Summary:            opendir() does not work with ftps:// wrapper
 Status:             Open
 Type:               Bug
 Package:            Directory function related
 Operating System:   Windows XP & 2003 R2
 PHP Version:        5.2.17
 Block user comment: N
 Private report:     N

 New Comment:

Apologies, the second warning listed in actual result is incomplete.

Full message is:
Warning: opendir(ftps://...@host:port/): failed to open dir: Unable to
activate SSL mode
FTP server reports 150 Accepted data connection
in <script path> on line 11

The fact that it gets far enough to recieve that error message from the
remote server suggests to me that this should work, and the first
message suggests that opendir() is trying to initiate the SSL/TLS
connection twice.

Wireshark captures show a lot of traffic between the client and server
before the errors are thrown, including a successful AUTH TLS command
and a successful TLS handshake.


Previous Comments:
------------------------------------------------------------------------
[2011-03-31 13:48:48] chrisw at networkm dot co dot uk

Description:
------------
opendir() triggers 2 warnings when used with ftps:// wrapper URLs and
fails.

fopen() works with files contained within the directory I am trying to
open.

If opendir() is not designed to work with ftps://, I would request this
as a feature (since ftp_ssl_open() does not work in standard Windows
builds).

Test script:
---------------
<?php

  // This works
  $fp = fopen("ftps://$user:$pass@$host:$port/$file");
  while ($part = fread($fp,1024)) $filedata .= $part;
  fclose($fp);
  print("Downloaded file:\n$filedata");

  // This doesn't work, triggers 2 warnings
  print("\n\nDirectory listing:\n");
  $dp = opendir("ftps://$user:$pass@$host:$port/");
  while ($file = readdir($dp)) print("$file\n");
  closedir($dp);

?>

Expected result:
----------------
Downloaded file:
<contents of file>

Directory listing:
<list of files>

Actual result:
--------------
Downloaded file:
<contents of file>

Directory listing:
Warning: opendir(): SSL/TLS already set-up for this stream in <script
path> on line 11
Warning: opendir(ftps://...@host:port/): failed to open dir: Unable to
activate SSL mode in <script path> on line 11


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



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


Thread (4 messages)

« previous php.bugs (#159873) next »