|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-07-10 21:49 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
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