From:             [EMAIL PROTECTED]
Operating system: debian
PHP version:      4.0.4pl1
PHP Bug Type:     Filesystem function related
Bug description:  is_file doesn't seem to work

In the docs for is_dir, i'm not sure if it wants a file name or a path name + file 
name. Either way, it doesn't seem to work on my debian/PHP4 (downloaded from 
dselect)/Apache box

Here's the script i'm attempting:

//--- List all the files in a directory
//--- Directory we're going after is /clients/data/
function get_files( $current_directory )
{                                                
  $directory = dir( $current_directory );

  $file_list = array();
  while ($element = $directory->read()) {        
    //--- The following line is never true
    if (is_file($element)) {
      $file_list[$element] = $element;           
    }  //--- if is_file                          
else {                                           
  echo "Not a file: $element<br>\n";             
  $path_and_name = $current_directory . $element;
  if (is_file($path_and_name)) {                 
    echo "Not a file: $path_and_name<br>\n";     
  }                                              
}                                                
  }  //--- while $element = $directory->read()   
                                                 
  //--- Directory list doesn't seem to be sorted,
  //--- so let's sort it                         
  asort($file_list);                             

  $directory->close();

  //--- Tell them what we've learned
  return $file_list;
}  //--- get_files


-b


-- 
Edit Bug report at: http://bugs.php.net/?id=9504&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to