|  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: 2014-07-13 02:50 UTC
Avg. Score:4.1 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (33.3%)
From: michael dot dalbosco at gmail dot com Assigned:
Status: Open Package: Directory function related
PHP Version: 5.6.0-dev OS: Linux
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
From manual page:

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/";

Expected result:
the directory resource

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-07 18:23 UTC] bluej100 at gmail dot com
This is discussed at, 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.
 [2014-07-13 02:50 UTC]
-Operating System: Debian 4.4.5-8 +Operating System: Linux -PHP Version: 5.3.21 +PHP Version: 5.6.0-dev
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 17:01:31 2015 UTC