php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38262 scandir list drive with "/."
Submitted: 2006-07-30 16:12 UTC Modified: 2006-07-30 16:16 UTC
From: vppnoel at yahoo dot fr Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.1.4 OS: win32
Private report: No CVE-ID: None
 [2006-07-30 16:12 UTC] vppnoel at yahoo dot fr
Description:
------------
When you use "/." as parameter for scandir function, you list the content of your drive's root in place of you server's root.

Reproduce code:
---------------
<?php

//List directories only
function list_dirs($path)
{
   $list = scandir($path);
   
   foreach ($list as $number => $filename)
   {
       if ( $filename !== '.' && $filename !== '..' && is_dir("$path/$filename") )
       {
           // Asign more readable and logic variables
           $dir = $filename;
           $url = apache_request_headers();
           

           {
               // Print Dirs with link
               print ("<a href=\"http://$url[Host]/$path/$dir\">/$path/$dir</a> <br>\n");
	       $newpath=$path . "/" . $dir;
	       list_dirs($newpath);
           }

               
       }
   }
}
   

list_dirs('/.')

?>

Expected result:
----------------
i would like to see the directories contained in the root of the server.

Actual result:
--------------
I see the directories contained in the root of the drive

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-30 16:16 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC