xref: /php-src/ext/spl/tests/bug68825.phpt (revision 66a5f9fb)
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--EXPECTF--
28string(%d) "%s%eext%espl%etests%ebug68825.php"
29--CLEAN--
30<?php
31$dir = __DIR__ . '/bug68825';
32unlink($dir . '/bug');
33rmdir($dir);
34?>
35