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
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:
22 - 18 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 11 07:06:08 2022 UTC