Bug #54256 [Com]: DirectoryIterator isn't iterable with a foreach

From: Date: Wed, 17 Mar 2021 05:42:19 +0000
Subject: Bug #54256 [Com]: DirectoryIterator isn't iterable with a foreach
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232799@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54256&edit=1 ID: 54256 Comment by: lne1030 at gmail dot com Reported by: gege2061 at homecomputing dot fr Summary: DirectoryIterator isn't iterable with a foreach Status: No Feedback Type: Bug Package: SPL related Operating System: Debian unstable PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: I got the same problem. Docker on Apline 3.13 within VirtualBox 5.2.44. Sharing a folder from Windows host, mounting it in Alpine and binding it to a container. Create a DirectoryIterator with its path in the container, traverse it by foreach get nothing, traverse it by while get expected data . Upgrade VirtualBox to 6.1 and the problem was gone. Previous Comments: ------------------------------------------------------------------------ [2014-07-30 13:20:04] xpundel at gmail dot com Debian under parallels on MacOS. The same problem: DirectoryIterator return nothing on mounted shared filders foreach (new DirectoryIterator('/media/psf/Web/') as $fileInfo) { echo $fileInfo->getFilename() . "<br>\n"; } ------------------------------------------------------------------------ [2013-11-11 21:34:22] andergmartins at gmail dot com I have the same issue, but using Parallels on a OS X. I'm running a virtualized Debian 7, PHP 5.4.4-14+deb7u5 as my dev server. The volume is mounted as a Parallels shared folder, in /media/psf/... I have tested this script: ----------------- <?php $iterador = new RecursiveDirectoryIterator( __DIR__ . '/t1/'); foreach ($iterador as $file) { var_dump($file); } ----------------- If the script is inside the shared folder, the result is a blank page. If I execute the script in a not shared folder, a native linux path, it shows an iterator for each dir content. ------------------------------------------------------------------------ [2013-02-18 00:34:45] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2012-10-26 19:34:33] maurice dot k at zend dot com The same problem occurs with Parallels Workstation under Windows 7, when using shared folders. DirectoryIterator is not iteratable using foreach. Windows 7 Parallels Workstation v6 Linux Ubuntu 12.04.1-LTS Any suggested workaround? ------------------------------------------------------------------------ [2011-09-23 07:01:25] sniper dot unreal at web dot de Hi Everyone, I had the same problem on ubuntu (which is also debian based). After installing the VirtualBox guest additions that are on the ISO that comes with VirtualBox instead of the guest additions bundled with debian/ubuntu solved the issue. So you just have do install the guest additions on your VM and it should work fine. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=54256 -- Edit this bug report at https://bugs.php.net/bug.php?id=54256&edit=1

« previous php.bugs (#232799) next »