mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
088e547802
There were two separate bugs here: * The get_iterator implementation did not match the Iterator implementation. In particular, get_iterator did not respect SKIP_DOTS. * The constructor did not honor an explicitly omitted SKIP_DOTS flag. It could still be unset through setFlags() though.
34 lines
507 B
PHP
34 lines
507 B
PHP
--TEST--
|
|
FileSystemIterator without SKIP_DOTS
|
|
--FILE--
|
|
<?php
|
|
|
|
$dir = __DIR__ . '/filesystemiterator_no_skip_dots';
|
|
mkdir($dir);
|
|
touch($dir . '/file');
|
|
|
|
$it = new FileSystemIterator($dir, 0);
|
|
$files = [];
|
|
foreach ($it as $f) {
|
|
$files[] = $f->getFileName();
|
|
}
|
|
sort($files);
|
|
var_dump($files);
|
|
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
$dir = __DIR__ . '/filesystemiterator_no_skip_dots';
|
|
unlink($dir . '/file');
|
|
rmdir($dir);
|
|
?>
|
|
--EXPECT--
|
|
array(3) {
|
|
[0]=>
|
|
string(1) "."
|
|
[1]=>
|
|
string(2) ".."
|
|
[2]=>
|
|
string(4) "file"
|
|
}
|