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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 - 15 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Apr 16 18:01:30 2024 UTC