|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31774 Data missing using DirectoryIterator with ftp:// wrapper
Submitted: 2005-01-31 02:32 UTC Modified: 2005-12-29 01:00 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: php at lachoseinteractive dot net Assigned: pollita (profile)
Status: No Feedback Package: FTP related
PHP Version: 5CVS-2005-03-20 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: php at lachoseinteractive dot net
New email:
PHP Version: OS:


 [2005-01-31 02:32 UTC] php at lachoseinteractive dot net
Reading a directory with a DirectoryIterator using an 
ftp wrapper doesn't work well.
Tested on 3 ftp servers. (proftp, ncftp, and ..unknown 
:-/). on 3 different machines and network.
With proftp and ncftp, some items are missing from the 
retrieved directory list. (whereas it works well with 
readdir()), even with a directory containing no more 
than 2 or 3 files. This doesn't seem to be related to 
the nature of the file, but rather to its position in 
the list : add a new file to the directory, and the 
previously missing file would show up, while another one 
is now missing.

On the third server (, the directory 
was correctly read.
In all cases, retrieving the list is very slow, and 
often fails.

Reproduce code:

$dir = new DirectoryIterator("");

foreach ( $dir as $f ) {
 if ( $f->isDot() ) continue;
 echo $f->getFilename()."\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-31 12:41 UTC] php at lachoseinteractive dot net
After more investigation, it turns out that the iterator 
reconnects to the server several times for each file of 
list in order to get SIZE information, etc instead of 
parsing a raw list from an FTP LIST command.
Looks like DirectoryIterator needs optimization for use 
with ftp wrapper.
 [2005-12-21 21:25 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-12-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Oct 01 23:01:24 2023 UTC