php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45576 readdir not working properly in ZFS filesystem (NFS mounted)
Submitted: 2008-07-21 09:29 UTC Modified: 2008-07-21 16:11 UTC
From: beluc62 at hotmail dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 5.2.6 OS: Debian
Private report: No CVE-ID: None
 [2008-07-21 09:29 UTC] beluc62 at hotmail dot com
Description:
------------
According to the manual, "readdir" Returns the filename of the next file from the directory. The filenames are returned in the order in which they are stored by the filesystem.

Under ZFS filesystem, return is not done in the right way.

tests are done under debian x86 with one zfs filer (sunOS) and one linux filer (debizn x86).

Reproduce code:
---------------
# mkdir temp
# cd temp/
# for i in `seq 0 19`; do touch $i.txt; done

<?php
$dir = opendir("temp");
while (false !== ($file = readdir($dir))) {
        echo "$file\n";
        }
?>

Expected result:
----------------
.
..
0.txt
1.txt
2.txt
3.txt
4.txt
5.txt
6.txt
7.txt
8.txt
9.txt
10.txt
11.txt
12.txt
13.txt
14.txt
15.txt
16.txt
17.txt
18.txt
19.txt

Actual result:
--------------
.
..
0.txt
7.txt
9.txt
12.txt
15.txt
14.txt
8.txt
13.txt
6.txt
1.txt
10.txt
17.txt
19.txt
2.txt
5.txt
4.txt
18.txt
3.txt
16.txt
11.txt

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-21 09:45 UTC] beluc62 at hotmail dot com
filers are both mounted via nfs
 [2008-07-21 16:11 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #27792.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jan 18 05:01:23 2021 UTC