readdir is not guaranteed to be in order
readdir's ordering is filesystem-dependent. On many systems, that means it might as well be random. People uploading archives will reasonably expect the files to appear in alphabetical order, so we should make sure they do.
This commit is contained in:
parent
305e25f676
commit
946dec9415
1 changed files with 8 additions and 1 deletions
|
@ -74,7 +74,14 @@ class ArchiveFileHandler extends Extension {
|
|||
$list = "";
|
||||
|
||||
$dir = opendir("$base/$subdir");
|
||||
while($filename = readdir($dir)) {
|
||||
|
||||
$files = array();
|
||||
while($f = readdir($dir)) {
|
||||
$files[] = $f;
|
||||
}
|
||||
sort($files);
|
||||
|
||||
foreach($files as $filename) {
|
||||
$fullpath = "$base/$subdir/$filename";
|
||||
|
||||
if(is_link($fullpath)) {
|
||||
|
|
Reference in a new issue