ID:               16830
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Duplicate
+Status:           Open
 Bug Type:         Filesystem function related
 Operating System: Windows 2000 SP2
 PHP Version:      4.2.0
 New Comment:

Sander, please tell me the Bug ID for it.

I did search the Bugs DB for open bugs with "file_exists".
The bug I'm talking about was reported as bug for PHP 4.1.0 ( Bug ID:
15218 ) and it has actually been fixed in 4.1.2, but now it appeared
again in PHP 4.2.0 !!
So this is no duplicate bugreport, I think.


Previous Comments:
------------------------------------------------------------------------

[2002-04-26 11:59:39] [EMAIL PROTECTED]

Plese, SEARCH the bugdb. There is a report about this. (sorry Jani ;)

------------------------------------------------------------------------

[2002-04-25 16:39:58] [EMAIL PROTECTED]

file_exists("") returns TRUE instead of FALSE

As per request, here are more details...

This:
<?

$filename="";

if (is_file($filename))
{
print "is_file sais, the file $filename <b>does exist</b>.<br>";
}
else
{
print "is_file sais, the file $filename <b>did not exist</b>.<br>";
}


if (file_exists($filename))
{
print "file_exists sais, the file $filename <b>does exist</b>.<br>";
}
else
{
print "file_exists sais, the file $filename <b>did not
exist</b>.<br>";
}

?>

will return:
is_file sais, the file did not exist.
file_exists sais, the file does exist.


Again, in other words:
If you give file_exists() an empty string as argument ( file_exists("")
), it will return TRUE (saying the file existed, but it does not,
because "" is no file.)

is_file() correctly returns FALSE if you give it an empty string as
argument and so should file_exists do, as it did in PHP 4.1.2


Further information:
I used to check my upload-scripts for uploaded files using
$file=$_FILES['datei']['tmp_name'];
if (file_exists($file)) { savefile($file); }
but I cannot use this anymore because when a user does not upload a
file, $filename becomes an empty string and file_exists returns TRUE,
so my function savefile($file) wants to save a non-uploaded file.

------------------------------------------------------------------------

[2002-04-25 16:14:54] [EMAIL PROTECTED]

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".




------------------------------------------------------------------------

[2002-04-25 15:57:50] [EMAIL PROTECTED]

file_exists("") returns TRUE instead of FALSE.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=16830&edit=1

Reply via email to