From:             webmaster at freshfm dot com dot au
Operating system: FreeBSD 4.7-RELEASE
PHP version:      4.3.6
PHP Bug Type:     Filesystem function related
Bug description:  file_exists incorrect behavior

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.


-- 
Edit bug report at http://bugs.php.net/?id=28445&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28445&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28445&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28445&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28445&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28445&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28445&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28445&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28445&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28445&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28445&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28445&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28445&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28445&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28445&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28445&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28445&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28445&r=float

Reply via email to