#48881 [NEW]: RecursiveDirectoryIterator bring file list in wrong order according to so
| From: | domluc at gmail dot com | Date: | Fri, 10 Jul 2009 19:49:15 +0000 |
| Subject: | #48881 [NEW]: RecursiveDirectoryIterator bring file list in wrong order according to so | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-139600@lists.php.net to get a copy of this message | ||
From: domluc at gmail dot com
Operating system: Linux ws63 2.6.24-24-generic #1
PHP version: 5.2.10
PHP Bug Type: Scripting Engine problem
Bug description: RecursiveDirectoryIterator bring file list in wrong order according to so
Description:
------------
Working with RecursiveDirectoryIterator bring a weird order in differrent
machines.
if I had a directory with two files:
test1.ext
test2.ext
in some installs the order will be
test1.ext
test2.ext
and in anothers will be
test2.ext
test1.ext
the main problem is that I can't trust in result, so the goal is iterator
guarantee a certain order in all
Reproduce code:
---------------
# you must create a 'test_data_fixtures' dir
# and put two files there test2.yml test1.yml
$dir = 'test_data_fixtures';
$it = new RecursiveDirectoryIterator($dir,
RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($it as $file) {
echo "File: " . $file . "\n";
}
Expected result:
----------------
File: test_data_fixtures/test1.yml
File: test_data_fixtures/test2.yml
Actual result:
--------------
File: test_data_fixtures/test2.yml
File: test_data_fixtures/test1.yml
--
Edit bug report at http://bugs.php.net/?id=48881&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48881&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48881&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48881&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48881&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48881&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48881&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48881&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48881&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48881&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48881&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48881&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48881&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48881&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48881&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48881&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48881&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48881&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48881&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48881&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48881&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48881&r=mysqlcfg