xref: /PHP-7.4/ext/spl/tests/bug68825.phpt (revision c49fb83c)
1--TEST--
2Bug #68825 (Exception in DirectoryIterator::getLinkTarget())
3--SKIPIF--
4<?php
5if (PHP_OS_FAMILY === 'Windows') {
6    include_once __DIR__ . '/../../standard/tests/file/windows_links/common.inc';
7    skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
8}
9?>
10--FILE--
11<?php
12$dir = __DIR__ . '/bug68825';
13
14if (!mkdir($dir)) {
15    die('Failed to create temporary directory for testing');
16} else if (!symlink(__FILE__, $dir . '/bug')) {
17    die('Failed to create symbolic link');
18}
19
20$di = new \DirectoryIterator($dir);
21foreach ($di as $entry) {
22    if ('bug' === $entry->getFilename()) {
23        var_dump($entry->getLinkTarget());
24    }
25}
26?>
27===DONE===
28--EXPECTF--
29string(%d) "%s%eext%espl%etests%ebug68825.php"
30===DONE===
31--CLEAN--
32<?php
33$dir = __DIR__ . '/bug68825';
34unlink($dir . '/bug');
35rmdir($dir);
36?>
37