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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vppnoel at yahoo dot fr
New email:
PHP Version: OS:

 

 [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-2023 The PHP Group
All rights reserved.
Last updated: Tue Jan 31 15:03:41 2023 UTC