From: craig dot marvelley at boxuk dot com Operating system: Linux (Debian) PHP version: 5.3.0 PHP Bug Type: SPL related Bug description: RecursiveDirectoryIterator doesn't descend into symlinked directories
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. -- Edit bug report at http://bugs.php.net/?id=48788&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48788&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48788&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48788&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48788&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48788&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48788&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48788&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48788&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48788&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48788&r=support Expected behavior: http://bugs.php.net/fix.php?id=48788&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48788&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48788&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48788&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48788&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48788&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48788&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48788&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48788&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48788&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48788&r=mysqlcfg