ID:               37070
 User updated by:  pornel at despammed dot com
 Reported By:      pornel at despammed dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         SPL related
 Operating System: OS X
 PHP Version:      6CVS-2006-04-13 (snap)
 New Comment:

My bad. Confused getPath with getPathname.


Previous Comments:
------------------------------------------------------------------------

[2006-04-13 12:19:28] pornel at despammed dot com

Description:
------------
I'm using RecursiveDirectoryIterator to scan directories.

File objects returned by this iterator seem to threat isDir and
hasChildren as the same thing. That is isDir returns true only when
item has children. 

This assumption is invalid and causes empty directories to be reported
as files.


Reproduce code:
---------------
<?php
function scan(RecursiveDirectoryIterator $dir)
{
        foreach($dir as $file)
        {
                var_dump($file->isDir());
                if ($dir->hasChildren()) scan($dir->getChildren());
        }
}
scan(new
RecursiveDirectoryIterator('/some/path/that/has/empty/dirs'));


Expected result:
----------------
isDir should not act as alias of hasChildren

Actual result:
--------------
empty directories have isFile()==true and isDir()==false


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37070&edit=1

Reply via email to