php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9504 is_file doesn't seem to work
Submitted: 2001-02-28 18:47 UTC Modified: 2001-04-10 10:13 UTC
From: baylor dot wetzel at bestbuy dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.4pl1 OS: debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: baylor dot wetzel at bestbuy dot com
New email:
PHP Version: OS:

 

 [2001-02-28 18:47 UTC] baylor dot wetzel at bestbuy dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-03 19:47 UTC] sniper@php.net
Your example scripts works just fine for me.
Try compiling PHP 4 from sources by yourself.

--Jani

 [2001-04-10 10:13 UTC] sniper@php.net
No feedback. If this happens also with soon to be released PHP 4.0.5, reopen this bug report.

--Jani

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 01:01:28 2025 UTC