|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-07-08 03:10 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
Description: ------------ In a Windows environment, RecursiveDirectoryIterator will treat symlinked directories as valid directories, descending into them accordingly. However on Linux this isn't the case, with a symlink being treated as a file (leaf). Reproduce code: --------------- <?php // create a 'proper' directory with a file mkdir('new_dir'); file_put_contents('new_dir/test.txt', 'test'); // create a symlink to our directory symlink('new_dir', 'symlink_dir'); $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__)); foreach($iterator as $object) { echo $object->getFilename() . "\n"; } Expected result: ---------------- On Windows Vista, I get this (executed in file test.php): test.txt test.txt test.php Which I would expect; the symlinked directory is treated as a regular directory, so the test file appears twice. Actual result: -------------- On Linux (same scenario): test.php symlink_dir test.txt . .. . .. The symlinked directory appears, but as a leaf; the contents of the directory are not discovered.