1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 06:51:18 +02:00
Files
archived-php-src/ext/spl/tests/dit_004.phpt
T
Nikita Popov 0535872b7c Use separate directory in dit_004.phpt
Make sure the directory is not modified while we're iterating it,
which may give unstable results.
2020-10-26 09:26:18 +01:00

37 lines
604 B
PHP

--TEST--
SPL: DirectoryIterator and clone
--FILE--
<?php
@mkdir($dir = __DIR__ . '/dit_004');
touch($dir . '/file1');
touch($dir . '/file2');
touch($dir . '/file3');
$a = new DirectoryIterator($dir);
$b = clone $a;
var_dump((string)$b == (string)$a);
var_dump($a->key(), $b->key());
$a->next();
$a->next();
$a->next();
$c = clone $a;
var_dump((string)$c == (string)$a);
var_dump($a->key(), $c->key());
?>
--CLEAN--
<?php
$dir = __DIR__ . '/dit_004';
unlink($dir . '/file1');
unlink($dir . '/file2');
unlink($dir . '/file3');
rmdir($dir);
?>
--EXPECT--
bool(true)
int(0)
int(0)
bool(true)
int(3)
int(3)