From: info at rustelekom dot biz Operating system: Linux 2.6.9-1.6_FC2smp PHP version: 4.3.10 PHP Bug Type: *Directory/Filesystem functions Bug description: Readdir give unsorted file list output
Description: ------------ Hello, On other system (with Fedora core 1 kernel version) same code give us file and directory list result sorted by created time (so, file created last - also showed as last in output list), but on this system we have other result and it is looks as unsorted (or sorted not by file created time in other words). On both system we use same locale (koi8r) and filesystem type (ext3). Sincerely Yours Dima Ivanov Reproduce code: --------------- <?php // Note that !== did not exist until 4.0.0-RC2 if ($handle = opendir('./')) { echo "Directory handle: $handle<br>"; echo "Files:<br>"; /* This is the correct way to loop over the directory. */ while (false !== ($file = readdir($handle))) { echo "$file<br>"; } /* This is the WRONG way to loop over the directory. */ /* while ($file = readdir($handle)) { echo "$file\n"; } */ closedir($handle); } ?> Expected result: ---------------- Fedora 1 system Directory handle: Resource id #2 Files: . .. SmallNuke_v1.zip SmallNuke_v1 blocks images bandmin-1.6.tar.gz includes language modules themes admin robots.txt modules.php .htaccess header.php footer.php index.php mainfile.php order cgi-bin test.php myLogs sql spaw banners forum.sql header.php.bak eurodns.html banners.php .htaccess.bak footer.php.bak mainfile.php.bak index.html.old api login order.php gate-order.inc.php rupay.php suspended.page index.html index.php.old .htaccess.old history < - this is file which newly created Actual result: -------------- Fedora 2 system Directory handle: Resource id #2 Files: auto.php auto_ind.php pictures search.php damp . sale.php .htaccess style sale_ind.php admin test.php < - this is file which newly created images rasdel_ind.php page.php rasdel.php include .. index.php logo.swf description.php reference.php print.php cgi-bin order.php -- Edit bug report at http://bugs.php.net/?id=31435&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31435&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31435&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31435&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31435&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31435&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31435&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31435&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31435&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31435&r=support Expected behavior: http://bugs.php.net/fix.php?id=31435&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31435&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31435&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31435&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31435&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31435&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31435&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31435&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31435&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31435&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31435&r=mysqlcfg