php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23722 with dir() is_file() return always false ...
Submitted: 2003-05-20 13:30 UTC Modified: 2003-05-20 16:49 UTC
From: ca533512 at tiscali dot cz Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 4.3.2RC3 OS: win2k SP3
Private report: No CVE-ID: None
 [2003-05-20 13:30 UTC] ca533512 at tiscali dot cz
I want to read a dir with dir() function and dir to open is like "images/php" then is_file() function doesn't working correctly ... (return false or NULL)

code:

$d = dir("images/php");
while ($file = $d -> read()) {
   if (is_file($file)) { // <- this line always return false
      ...
   }
}

when i use chdir() function to change directory, all working correctly ...

Must I use chdir() func. ???
is this a regular feature ???

jenik

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-20 16:49 UTC] nicos@php.net
Yes, it is an expected feature. You have to do if(is_file('images/php/'.$file)). dir() will not chdir so when you call is_file it tries to see if $file is present in your current directory.

Not a bug -> Bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 12 09:01:27 2024 UTC