php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81669 DirectoryIterator ignore files
Submitted: 2021-11-28 13:46 UTC Modified: 2021-11-29 10:06 UTC
From: wapinet at mail dot ru Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 8.0.13 OS: Alpine Linux
Private report: No CVE-ID: None
 [2021-11-28 13:46 UTC] wapinet at mail dot ru
Description:
------------
DirectoryIterator (and RecursiveDirectoryIterator) returns fewer files than should be in some cases.
But scandir/opendir+readdir returns all files.
It produces only in alpine linux in my tests. centos/windows doesn't have the problem.

Test script:
---------------
https://github.com/Gemorroj/php-directoryiterator-bug


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-28 16:15 UTC] antonino dot spampinato86 at gmail dot com
Maybe it is irrelevant but if you set the index directly is it always an element?

$arr = array(0 => null);
$i = 0;
//example foreach
while($i < 5) {
if(is_null($arr[0]))
$arr[0] = 'value';
$arr = $arr + array($i => 'value');
++$i;
}
var_dump($arr);
 [2021-11-29 10:05 UTC] wapinet at mail dot ru
-Status: Open +Status: Closed
 [2021-11-29 10:05 UTC] wapinet at mail dot ru
most likely it's bug of docker-win. not php
 [2021-11-29 10:06 UTC] wapinet at mail dot ru
https://github.com/docker/for-win/issues/12405
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Feb 04 13:03:38 2023 UTC