php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61297 readdir hangs when connected to Solaris
Submitted: 2012-03-06 00:33 UTC Modified: 2012-06-20 14:59 UTC
From: tjg at soe dot ucsc dot edu Assigned:
Status: Not a bug Package: ssh2 (PECL)
PHP Version: 5.3.10 OS: FreeBSD => Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
29 - 7 = ?
Subscribe to this entry?

 
 [2012-03-06 00:33 UTC] tjg at soe dot ucsc dot edu
Description:
------------
Hi,

I am connecting to a Solaris file server and running a readdir (see the test script for more information).

The script iterates through everything in the folder, and then on the last iteration, where readdir() should return false, it just hangs.  The process is killable via ctrl-C but it never completes that loop.  The folder in question has a few hundred files, but other systems are able to list the files in that folder without a problem.  I've tried two different PHP clients: FreeBSD (PHP 5.3.10) clients and CentOS (5.1.6) and both behave the same way.  Other SFTP applications do not seem to have this problem.  For example, if I connect using the FreeBSD SFTP command-line client, it works as expected.

Test script:
---------------
$folder = opendir("ssh2.sftp://" . $sftp . $folder_name);

if (!$folder) {
  echo "ERROR: Could not list folder contents on " . $server_name . "!\n";

  exit(1);
}

while (($file_name = readdir($folder)) !== false) {
  echo $file_name . "\n";
}


Expected result:
----------------
It should print out a list of the files in the remote folder.

Actual result:
--------------
The script hangs on what should be the last readdir().

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-16 09:45 UTC] langemeijer@php.net
I sent tjg an email on how to proceed to solve this bug, as I don't have a 
Solaris server to debug this.
 [2012-06-18 15:33 UTC] tjg at soe dot ucsc dot edu
I am very sorry that I didn't resolve this ticket earlier.  I actually totally forgot about it.  Patching SunOS actually appears to have fixed this problem, so my guess is that it was a problem with their SSH server and not the PECL module.  Sorry about not reporting that sooner!  :\
 [2012-06-20 14:59 UTC] langemeijer@php.net
-Status: Open +Status: Not a bug
 [2012-06-20 14:59 UTC] langemeijer@php.net
Happy this is solved!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 15:01:28 2024 UTC