1--TEST--
2SPL: RecursiveDirectoryIterator::hasChildren() follow symlinks test
3--FILE--
4<?php
5
6$dir = __DIR__ . DIRECTORY_SEPARATOR . 'symlinktest';
7
8if (!mkdir($dir)) {
9    die('Failed to create temporary directory for testing');
10} elseif (!symlink(__DIR__, $dir . DIRECTORY_SEPARATOR . 'symlink')) {
11    die('Failed to create symbolic link');
12}
13
14$it = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS | FilesystemIterator::FOLLOW_SYMLINKS | FilesystemIterator::KEY_AS_FILENAME);
15
16var_dump($it->key());
17var_dump($it->hasChildren());
18
19$it->setFlags(FilesystemIterator::SKIP_DOTS | FilesystemIterator::KEY_AS_FILENAME);
20
21var_dump($it->key());
22var_dump($it->hasChildren());
23
24?>
25--EXPECT--
26string(7) "symlink"
27bool(true)
28string(7) "symlink"
29bool(false)
30--CLEAN--
31<?php
32$dir = __DIR__ . DIRECTORY_SEPARATOR . 'symlinktest';
33if (PHP_OS_FAMILY == 'Windows') {
34    rmdir($dir . DIRECTORY_SEPARATOR . 'symlink');
35} else {
36    unlink($dir . DIRECTORY_SEPARATOR . 'symlink');
37}
38rmdir($dir);
39?>
40