#49900 [NEW]: RecursiveIteratorIterator fails when path variable contains folders name "root"
| From: | wloske at yahoo dot de | Date: | Fri, 16 Oct 2009 13:21:39 +0000 |
| Subject: | #49900 [NEW]: RecursiveIteratorIterator fails when path variable contains folders name "root" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143631@lists.php.net to get a copy of this message | ||
From: wloske at yahoo dot de
Operating system: Win XP SP2
PHP version: 5.2.11
PHP Bug Type: SPL related
Bug description: RecursiveIteratorIterator fails when path variable contains folders name
"root"
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 bug report at http://bugs.php.net/?id=49900&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49900&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49900&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49900&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49900&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49900&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49900&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49900&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49900&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49900&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49900&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49900&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49900&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49900&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49900&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49900&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49900&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49900&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49900&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49900&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49900&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49900&r=mysqlcfg