|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-16 13:35 UTC] colder@php.net
[2009-10-16 13:41 UTC] wloske at yahoo dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Jun 23 02:00:01 2026 UTC |
Description: ------------ The RecursiveIteratorIterator fails when the variable containing the path name to be traversed contains "root" anywhere. Scanning a directory containing a folder named root works though. 1. Try the code, nothing should happen. 2. Rename the directory to "woot" and adjust the $basedir variabel 3. Restart the code. You should see a result 4. Make a directory like test and a directory inside named "root" with some content in it. 5. Adjust $basedir to point to the parent of "root", e.g. "e:\test" 6. Restart. You should see the contents of test including the folder "root". 7. Adjust $basedir to point to "root" itself, e.g. "E:\test\root" 8. Restart. You should see nothing Reproduce code: --------------- $basedir = realpath("E:\root"); echo "<html><body><pre>"; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir, RecursiveDirectoryIterator::KEY_AS_PATHNAME), RecursiveIteratorIterator::CHILD_FIRST) as $file => $info) { if ($info->isDir()) { //Directory echo "Dir: ".$file."<br />"; } else { //File echo "File: ".$file."<br />"; } } echo "</pre></body><html>"; Expected result: ---------------- A list of directories in the given path. Actual result: -------------- Nothing. Neither a listing nor an error. Just plain silence.