php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28445 file_exists incorrect behavior
Submitted: 2004-05-19 14:49 UTC Modified: 2004-07-06 01:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: webmaster at freshfm dot com dot au Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.6 OS: FreeBSD 4.7-RELEASE
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: webmaster at freshfm dot com dot au
New email:
PHP Version: OS:

 

 [2004-05-19 14:49 UTC] webmaster at freshfm dot com dot au
Description:
------------
PHP4.3.6RC3 Actually. Previously reported for different versions; #21410, #16830

Will *at seemingly random* times produce incorrect behavior.

IE:
"./images/members/admin.jpg" does not exist, but for some reason it returns true.

Apologies if this has been corrected in later versions, I can't tell - my ISP is evil.

Reproduce code:
---------------
function pictureExists($path, $extensions) {

    for ($i=0;$i<=count($extensions);$i++) {
		print $path . "." . $extensions[$i];
		phpinfo();
		print file_exists($path . "." . $extensions[$i]);
		print true;
        if (file_exists($path . "." . $extensions[$i]) == true) {
            return "." . $extensions[$i];
        }
    }

    return false;
}

$path = "./images/members/admin";
$exts[] = "jpg";
pictureExists($path,$exts);

Expected result:
----------------
return true


Actual result:
--------------
return false.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-06 01:44 UTC] sniper@php.net
See the manual page for file_exists() and the note about 'cached'..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 06:01:29 2024 UTC