Bug #16830 Updated: file_exists("") returns TRUE instead of FALSE
| From: | sniper@php.net | Date: | Thu, 16 May 2002 01:08:25 +0000 |
| Subject: | Bug #16830 Updated: file_exists("") returns TRUE instead of FALSE | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-7808@lists.php.net to get a copy of this message | ||
ID: 16830
Updated by: sniper@php.net
Reported By: soeren.fleischer@gmx.net
-Status: Analyzed
+Status: Closed
Bug Type: Filesystem function related
Operating System: ANY
PHP Version: 4.3.0-dev
New Comment:
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a
documentation
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-04-27 20:39:46] cynic@php.net
something stinks here:
[2002-04-27 10:41:44] sniper@php.net
$filename="";
$bb = is_file($filename);
var_dump($bb);
int(0)
yohgaki:
$filename="";
$bb = is_file($filename);
var_dump($bb);
bool(false)
so does is_file() return false or 0? plus it returned int(1) for you,
which it shouldn't either (should return bool(true) instead). WTF?
------------------------------------------------------------------------
[2002-04-27 20:09:29] yohgaki@php.net
I added following test case (ext/standard/tests/file/003.phpt)
<?php
$filename="";
$bb = is_file($filename);
var_dump($bb);
$aa = file_exists($filename);
var_dump($aa);
$filename="php.ini-dist";
$bb = is_file($filename);
var_dump($bb);
$aa = file_exists($filename);
var_dump($aa);
?>
Result:
[yohgaki@dev HEAD]$ cat ext/standard/tests/file/003.out
bool(false)
bool(false)
int(1)
bool(true)
------------------------------------------------------------------------
[2002-04-27 19:57:58] yohgaki@php.net
Just curious, is this fixed?
(I was about to commit test case for this bug)
[yohgaki@dev HEAD]$ ./cli-php ext/standard/tests/file/003.inc
bool(false)
bool(false)
------------------------------------------------------------------------
[2002-04-27 13:09:43] cynic@php.net
Jani, the var_dump()s IMO show two bugs: the other is that is_file()
returned int(0), while it's documented to be a bool type. could you
check this too?
------------------------------------------------------------------------
[2002-04-27 10:41:44] sniper@php.net
Duh. You're right, it's a bug.
<?php
$filename="";
$bb = is_file($filename);
var_dump($bb);
$aa = file_exists($filename);
var_dump($aa);
?>
Outputs:
int(0)
bool(true)
--Jani
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/16830
--
Edit this bug report at http://bugs.php.net/?id=16830&edit=1