Bug #55832 [Bgs]: is_file() returns true if file does NOT exist
| From: | pajoye@php.net | Date: | Tue, 04 Oct 2011 12:55:43 +0000 |
| Subject: | Bug #55832 [Bgs]: is_file() returns true if file does NOT exist | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164077@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55832&edit=1
ID: 55832
Updated by: pajoye@php.net
Reported by: christian dot koncilia at gmx dot net
Summary: is_file() returns true if file does NOT exist
Status: Bogus
Type: Bug
Package: Filesystem function related
Operating System: Windows 7
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
This is a wrong explanation.
It is by no mean due to the Win32 API idiosyncrasy but the usage of
FindFirstFile. Its behavior is clearly documented (http://msdn.microsoft.com/en-
us/library/windows/desktop/aa364418(v=vs.85).aspx) and we should actually stop
to use it in realpath and related functions.
By doing so we also have to do the case conversion manually as well (btw,
amazing that we have to do that for the case insensitive filesystem ;).
However, I keep this bug as bogus as we already have a feature request to solve
this problem.
Previous Comments:
------------------------------------------------------------------------
[2011-10-04 10:55:37] cataphract@php.net
Expected behavior. See DOS device names. This is an idiosyncrasy of the windows API.
------------------------------------------------------------------------
[2011-10-02 14:12:01] christian dot koncilia at gmx dot net
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 this bug report at https://bugs.php.net/bug.php?id=55832&edit=1