From:             richard dot quadling at bandvulc dot co dot uk
Operating system: Windows
PHP version:      5.0.5
PHP Bug Type:     SPL related
Bug description:  RecursiveDirectoryIterator is not recursive

Description:
------------
Hopefully, my simple brain can explain this properly.

I want to use the RecursiveDirectoryIterator class.

Iterator = get "elements" from a "list", one at a time.
Directory = a "list" of files and directories (and links for those *ix
bods).
Recursion = Repeat until complete on any "element" which contains a
"list".

So, DirectoryIterator should return a list of files/directories for a
single directory.

Which it does.

<?php
$objDI = new DirectoryIterator("C:/");
foreach($objDI as $key => $value)
        {
        echo "$key $value\n";
        }
?>

produces a list of all the files and directories in the root of my C:.
Just like I would expect.


A RecursiveDirectoryIterator

So, in my limited understanding (OK, I'm being facetous - I've been
fighting Crystal Reports all day, so please give me a break), by using the
RecursiveDirectoryIterator, I would expect to get a list of all the files
and directories and sub-directories from C:\ onwards, a complete
treewalk.

<?php
$objRDI = new RecursiveDirectoryIterator("C:/");
foreach($objRDI as $key => $value)
        {
        echo "$key\n";
        }
?>

But no.

All this does is print the same list as DirectoryIterator. Admittedly, the
name is now a key and the value is an object, but how is this recursive?

Either proper documentation for RecursiveDirectoryIterator (what is it
recursing?) or a change to the name as it is NOT recursing is
appropriate.

I've read the documentation at Helly, but it makes no sense as there no
examples. It looks like I have to implement the recursion myself, so what
does the class recurse?

Hopefully you can see my problem.

Richard Quadling.


-- 
Edit bug report at http://bugs.php.net/?id=34615&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34615&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34615&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34615&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34615&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34615&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34615&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34615&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34615&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34615&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34615&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34615&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34615&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34615&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34615&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34615&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34615&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34615&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34615&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34615&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34615&r=mysqlcfg
  • #34615 [NEW]: RecursiveDire... richard dot quadling at bandvulc dot co dot uk

Reply via email to