ID:               48547
 Updated by:       garre...@php.net
 Reported By:      BinaryKitten at jkrswebsolutions dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         SPL related
 Operating System: win32 only - WinXP SP3
 PHP Version:      5.2.9
-Assigned To:      
+Assigned To:      garretts
 New Comment:

Use the FilesystemIterator class (a subclass of DirectorIterator) if
you want to force the directory separator to the forward slash.

Directory iterator only supports the default platform slash.

http://us.php.net/manual/en/class.filesystemiterator.php

// will use forward slashes.
$dir = new FilesystemIterator( $path, 8192 );






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

[2009-06-14 19:22:59] webmaster at asylum-et dot cm

I have tested this on Windows XP SP3 with PHP 5.2.5 and have the same 
findings as BinaryKitten at jkrswebsolutions dot co dot uk

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

[2009-06-14 11:47:49] BinaryKitten at jkrswebsolutions dot co dot uk

Description:
------------
When using the DirectoryIterator to go through files/folders on Windows
under apache, the path has a mismatch of \ and /

Reproduce code:
---------------
<?php
$dir = new DirectoryIterator( $_SERVER['DOCUMENT_ROOT'] );
echo "<strong>".$dir->getPath()."</strong><br />";
foreach($dir as $file ) {
  $dirName = $file->getPathname();
  echo $dirName."<br />";
}
?>

Expected result:
----------------
With the Document root as C:\HTDOCS Apache returns
$_SERVER['DOCUMENT_ROOT'] as c:/HTDOCS

Expected Output
C:/HTDOCS/.
C:/HTDOCS/..
C:/HTDOCS/css
C:/HTDOCS/index.php
C:/HTDOCS/js
C:/HTDOCS/

Actual result:
--------------
C:/HTDOCS\.
C:/HTDOCS\..
C:/HTDOCS\css
C:/HTDOCS\index.php
C:/HTDOCS\js



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


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

Reply via email to