php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64169 opendir not working with sftp since upgrade from php 5.3.14 to 5.3.21
Submitted: 2013-02-07 11:17 UTC Modified: -
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: michael dot dalbosco at gmail dot com Assigned:
Status: Open Package: Directory function related
PHP Version: 5.3.21 OS: Debian 4.4.5-8
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-02-07 11:17 UTC] michael dot dalbosco at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.opendir#refsect1-function.opendir-description
---

I'm connecting to a Sftp server and try to open a directory on this server. It worked fine on php 5.3.10 and php 5.3.14 but since we upgraded to 5.3.21 it doesn't work anymore, opendir returns false.


Test script:
---------------
$con = ssh2_connect($server, $port);
ssh2_auth_pubkey_file ( $con, $login, $pubKeyFile, $privKeyFile);
$sftp = ssh2_sftp($con);
$dir = "ssh2.sftp://$sftp/";
var_dump(opendir($dir));

Expected result:
----------------
the directory resource

Actual result:
--------------
false

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-07 18:23 UTC] bluej100 at gmail dot com
This is discussed at http://stackoverflow.com/a/16238476/69173, which notes that you can work around the issue by appending an explicit current-directory period.

I'm willing to try to create a patch for this. It'll be a little tough to write a test case for it, though--should I include a reference to a public sftp share?
 [2013-05-07 18:25 UTC] bluej100 at gmail dot com
This ticket may belong under PECL->SSH2 rather than directory functions.
 [2013-05-07 23:48 UTC] bluej100 at gmail dot com
I've done a build of 5.6.0-dev head with ssh2 0.12 and confirmed that this bug is still present.
 [2013-05-18 16:44 UTC] bluej100 at gmail dot com
To clarify, this issue specifically affects the root directory, if Michael and I are seeing the same thing. Subdirectory listing works fine.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 21:01:55 2014 UTC