xref: /PHP-8.3/ext/spl/tests/bug68557.phpt (revision ded3d984)
1--TEST--
2Bug #68557 (SplFileInfo::getPathname() may be broken)
3--FILE--
4<?php
5mkdir(__DIR__ . DIRECTORY_SEPARATOR . 'tmp');
6touch(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'a');
7touch(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'b');
8
9$d = new DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'tmp');
10
11$d->seek(0);
12$path0 = $d->current()->getPathname();
13
14$d->seek(1);
15$path1 = $d->current()->getPathname();
16
17$d->seek(2);
18$path2 = $d->current()->getPathname();
19
20$d->seek(0);
21var_dump($path0 === $d->current()->getPathname());
22
23$d->seek(1);
24var_dump($path1 === $d->current()->getPathname());
25
26$d->seek(2);
27var_dump($path2 === $d->current()->getPathname());
28
29$d->seek(0);
30var_dump($path0 === $d->current()->getPathname());
31?>
32--CLEAN--
33<?php
34unlink(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'a');
35unlink(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'b');
36rmdir(__DIR__ . DIRECTORY_SEPARATOR . 'tmp');
37?>
38--EXPECT--
39bool(true)
40bool(true)
41bool(true)
42bool(true)
43