#49900 [Bgs]: RecursiveIteratorIterator fails when path variable contains folders name "root"
| From: | wloske at yahoo dot de | Date: | Fri, 16 Oct 2009 13:41:21 +0000 |
| Subject: | #49900 [Bgs]: RecursiveIteratorIterator fails when path variable contains folders name "root" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-143634@lists.php.net to get a copy of this message | ||
ID: 49900
User updated by: wloske at yahoo dot de
Reported By: wloske at yahoo dot de
Status: Bogus
Bug Type: SPL related
Operating System: Win XP SP2
PHP Version: 5.2.11
New Comment:
LOL ... I just figured that out myself ... stupid me ... I just should
always use slash instead of backslash when typing paths ...
Sorry guys ... I just made a fool out of myself ;) ... I am still
laughing ...
Is there a way to delete this piece of an "epic fail documentation" ;)
Previous Comments:
------------------------------------------------------------------------
[2009-10-16 13:35:50] colder@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
err, that's because \r is carriare return inside "" ?
------------------------------------------------------------------------
[2009-10-16 13:21:38] wloske at yahoo dot de
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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49900&edit=1