1
0
mirror of https://github.com/php/php-src.git synced 2026-04-13 19:14:16 +02:00
Files
archived-php-src/ext/spl/tests/bug68825.phpt
2020-03-06 16:38:49 +01:00

37 lines
762 B
PHP

--TEST--
Bug #68825 (Exception in DirectoryIterator::getLinkTarget())
--SKIPIF--
<?php
if (PHP_OS_FAMILY === 'Windows') {
$fn = "bug68825.lnk";
$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out);
@unlink($fn);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
}
?>
--FILE--
<?php
$dir = __DIR__ . '/bug68825';
mkdir($dir);
symlink(__FILE__, "$dir/foo");
$di = new \DirectoryIterator($dir);
foreach ($di as $entry) {
if ('foo' === $entry->getFilename()) {
var_dump($entry->getLinkTarget());
}
}
?>
===DONE===
--EXPECTF--
string(%d) "%s%eext%espl%etests%ebug68825.php"
===DONE===
--CLEAN--
<?php
$dir = __DIR__ . '/bug68825';
unlink("$dir/foo");
rmdir($dir);
?>