-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
I know this is a PHP bug, but it can be avoided. This might be related to https://bugs.php.net/bug.php?id=54256
Please use
<?php
$it->rewind();
while ($it->valid()) {
echo $it->current()->getBasename().PHP_EOL;
$it->next();
}
?>
In favor of
<?php
foreach ($it as $file) {
echo $file->getBasename().PHP_EOL;
}
?>
Steps to reproduce
- Given $DIR is on an NFS mount
- mkdir $DIR/test
- touch $DIR/test/foo.bar
- cd $DIR
- Run:
<?php
$path = getcwd().'/test';
$it = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($path),
\RecursiveIteratorIterator::CHILD_FIRST
);
echo 'Test with foreach: '.PHP_EOL;
foreach ($it as $file) {
echo $file->getBasename().PHP_EOL;
}
?>
- Run:
<?php
$path = getcwd().'/test';
$it = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($path),
\RecursiveIteratorIterator::CHILD_FIRST
);
echo 'Test with while: '.PHP_EOL;
$it->rewind();
while ($it->valid()) {
echo $it->current()->getBasename().PHP_EOL;
$it->next();
}
?>
Expected behaviour
Test with foreach:
foo.bar
..
Test with while:
.
foo.bar
..
Actual behaviour
Test with foreach:
Test with while:
.
foo.bar
..
The foreach fails.
Server configuration
Operating system:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.4 LTS
Release: 12.04
Codename: precise
Web server:
Server version: Apache/2.2.22 (Ubuntu)
Server built: Mar 19 2014 21:11:10
Database:
psql (PostgreSQL) 9.1.9
PHP version:
PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch (cli) (built: Apr 4 2014 01:30:04)
ownCloud version: (see ownCloud admin page)
ownCloud 6.0.2 (git)
Updated from an older ownCloud or fresh install:
fresh install
List of activated apps:
none
The content of config/config.php:
Upon request
Are you using external storage, if yes which one: local/smb/sftp/...
NFS3 on a local mount
Are you using encryption: yes/no
encripted partition
Client configuration
Browser:
N/A
Operating system:
N/A
Logs
Web server error log
N/A
ownCloud log (data/owncloud.log)
N/A
Browser log
N/A