1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00
Files
archived-php-src/ext/spl/tests/filesystemiterator_no_skip_dots.phpt
T
Nikita Popov 088e547802 Fix FileSystemIterator without SKIP_DOTS
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.
2021-09-24 14:40:46 +02:00

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"
}