Bug #55832 [Opn->Bgs]: is_file() returns true if file does NOT exist

From: Date: Tue, 04 Oct 2011 10:55:37 +0000
Subject: Bug #55832 [Opn->Bgs]: is_file() returns true if file does NOT exist
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-164075@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: cataphract@php.net Reported by: christian dot koncilia at gmx dot net Summary: is_file() returns true if file does NOT exist -Status: Open +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: Expected behavior. See DOS device names. This is an idiosyncrasy of the windows API. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#164075) next »