SUMMARY:
Listing the contents of a directory will stop when any unreadable entry (file or directory) is reached. The correct behavior is to omit all unreadable entries but include all readable entries.

STEPS TO REPRODUCE:
1. In the file system, create a directory that is readable by PHP.
2. In that directory, add several entries. Some should be readable, some should be unreadable (to PHP user).
3. In drupal, create a Directory Listing node. Use the directory created in step 1.
RESULT:
Not all the readable entries will appear. Any number of entries may appear, based on the order the entries were processed by the PHP readdir() command.

HOW TO FIX:
Inside filebrowser.module, filebrowser_view function.
Change the following line:

while (($file = readdir($dh)) !== false && is_readable($curr_dir . '/' . $file)) {

to the following:

while (($file = readdir($dh)) !== false) {

  if (!is_readable($curr_dir . '/' . $file))
    continue;

That fixes the issue.

Comments

Yoran’s picture

Status: Needs review » Fixed

I applied your patch in dev snapshot.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.