ID:               45345
 Updated by:       [EMAIL PROTECTED]
 Reported By:      RQuadling at GMail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         SPL related
 Operating System: Windows XP SP2
 PHP Version:      5.3CVS-2008-06-24 (CVS)
 Assigned To:      colder
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




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

[2008-06-24 10:29:14] RQuadling at GMail dot com

Description:
------------
Using RII(RID()) to traverse a directory tree.

Using ->getFileInfo() to see what it returned.

The result contains an array with 2 entries, which are based upon the
directory of the object making the call and not the filename.

It might be me (hey, I've got more bogus bugs than actual ones, but I
think this is a real one this time!).

I'm drawn in 2 ways for the expected results.

Either ...

1 - "pathName" and "fileName" should match getPathname() and
getFilename()

or

2 - getPathInfo() should return the same values as pathinfo()



Reproduce code:
---------------
<?php
// Create a small directory structure in %TEMP%
$s_Root = getenv('TEMP') . DIRECTORY_SEPARATOR . 'RAQ1';
$s_Dir = $s_Root . DIRECTORY_SEPARATOR . 'RAQ2' . DIRECTORY_SEPARATOR .
'RAQ3' . DIRECTORY_SEPARATOR . 'RAQ4';
mkdir($s_Dir, 0777, True);

// Add a file to the new tree.
file_put_contents($s_Dir . DIRECTORY_SEPARATOR . 'test.txt', 'This is a
test');

// Iterate.
foreach(new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($s_Root)) as $o_File)
        {
        echo 'Pathname:', $o_File->getPathname(), PHP_EOL, 'Filename:',
$o_File->getFilename(), PHP_EOL;
        $a_PathInfo = $o_File->getPathinfo();
        var_dump($a_PathInfo);
        }

// Remove test files and tree.
unlink($s_Dir . DIRECTORY_SEPARATOR . 'test.txt');
rmdir($s_Dir);
rmdir(dirname($s_Dir));
rmdir(dirname(dirname($s_Dir)));
rmdir(dirname(dirname(dirname($s_Dir))));


Expected result:
----------------
D:\TEMP\RAQ1\RAQ2\RAQ3\RAQ4\test.txt
object(SplFileInfo)#8 (2) {
  ["pathName":"SplFileInfo":private]=>
  string(22) "D:\TEMP\RAQ1\RAQ2\RAQ3\RAQ4\test.txt"
  ["fileName":"SplFileInfo":private]=>
  string(27) "test.txt"
}

pathName should match getPathname()
filename should match getFilename()

OR

splfileinfo::getPathInfo() should return the same values as pathinfo()

Actual result:
--------------
Pathname:D:\TEMP\RAQ1\RAQ2\RAQ3\RAQ4\test.txt
Filename:test.txt
object(SplFileInfo)#8 (2) {
  ["pathName":"SplFileInfo":private]=>
  string(22) "D:\TEMP\RAQ1\RAQ2\RAQ3"
  ["fileName":"SplFileInfo":private]=>
  string(27) "D:\TEMP\RAQ1\RAQ2\RAQ3\RAQ4"
}


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


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

Reply via email to