Bug #55832 [NEW]: is_file() returns true if file does NOT exist
| From: | christian dot koncilia at gmx dot net | Date: | Sun, 02 Oct 2011 14:12:01 +0000 |
| Subject: | Bug #55832 [NEW]: is_file() returns true if file does NOT exist | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-164030@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 7
PHP version: 5.3.8
Package: Filesystem function related
Bug Type: Bug
Bug description:is_file() returns true if file does NOT exist
Description:
------------
Using Windows 7, create a directory "C:\dirtest\Au". Run the test script.
Output produced is:
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
although neither $file1 nor $file2 exist! Expected output would be
"bool(false)" in all cases.
Test script:
---------------
<?php
$file1 = 'C:\dirtest\Au\aux.gtb';
$file2 = 'C:\dirtest\Au\bux.gtb';
var_dump(is_file($file1));
var_dump(file_exists($file1));
var_dump(is_readable($file1));
var_dump(is_file($file2));
var_dump(file_exists($file2));
var_dump(is_readable($file2));
Expected result:
----------------
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Actual result:
--------------
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=55832&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55832&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55832&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55832&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55832&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55832&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55832&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55832&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55832&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55832&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55832&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55832&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55832&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55832&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55832&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55832&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55832&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55832&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55832&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55832&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55832&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55832&r=mysqlcfg