php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80660 FilesystemIterator foreach-loop fails on fuse filesystems
Submitted: 2021-01-22 13:53 UTC Modified: -
From: shop1 at mokraemer dot de Assigned:
Status: Open Package: *Directory/Filesystem functions
PHP Version: 7.4.14 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-01-22 13:53 UTC] shop1 at mokraemer dot de
Description:
------------
As for my testing, FilesystemIterator fails with the foreach loop while the while-next loop works as expected.

Test script:
---------------
<?php
$iterator = new \FilesystemIterator(
	'/fuse-filesystem',
             \FilesystemIterator::CURRENT_AS_SELF
           | \FilesystemIterator::SKIP_DOTS
);
echo "--while\n";
while($iterator->valid()) {
	echo $iterator->current()."\n";
	$iterator->next();
}
$iterator->rewind();
echo "--for\n";
foreach ($iterator as $entry) {
	echo $entry->getFilename()."\n";
}


Expected result:
----------------
--while
.hg
file1.class.php
file2.class.php
--for
.hg
file1.class.php
file2.class.php


Actual result:
--------------
--while
.hg
file1.class.php
file2.class.php
--for


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Mar 02 19:01:25 2021 UTC