From: iubito at asp-php dot net
Operating system: Windows (all)
PHP version: 4.3.3
PHP Bug Type: *Directory/Filesystem functions
Bug description: CON, NUL, PRN... special files : is_file return true
Description:
------------
Hello
As we often forget that Windows is based on DOS... we forget that in DOS
it exists special file (CON, NUL, PRN, LPT1, LPT2, AUX, COM1, COM2, COM3,
COM4). Under DOS, echo foobar > nul
nul is considered as a file.
Now in Windows Explorer, if you try to create a file called
aux.<the_extension_you_want> or nul.bmp or prn.zip or lpt2.php... Windows
return an error, something like "Impossible to create nul.bmp, a file with
this name already exists..."
That shows us that windows consider aux.* nul.* con.* as files.
Now here I want to go...
All functions like is_directory, is_file, file_exists... should return
false.
Since today, it ask windows "does the file nul.bmp exist ?" and Windows
answer "yes!".
But this file is not openable, writeable, readable.
Reproduce code:
---------------
<?
$bugfile = 'c:/nul.gif'; // or aux.* or con.*....
if (is_file($bugfile))
echo $bugfile.' exists! <img src="'.$bugfile.'" />';
else
echo $bugfile.' doesn\'t exist!';
// Now is a more problematic case I've seen in my app
$inc = 'aux.php'; // the name is generated automatically...
if (is_file('mydirectory/'.$inc)) {
include('mydirectory/'.$inc);
}
?>
Expected result:
----------------
c:/nul.gif doesn't exist!
Actual result:
--------------
c:/nul.gif exists <img src="c:/nul.gif" /> <-- that's a red cross!
Warning: main(PHPmyBrowserCustom/addon-file/AUX.php): failed to open
stream: No such file or directory in
F:\www\pays\flags\PHPmyBrowser\main.php on line 587
Fatal error: main(): Failed opening required
'PHPmyBrowserCustom/addon-file/AUX.php' (include_path='.;c:\php4\pear') in
F:\www\pays\flags\PHPmyBrowser\main.php on line 587
--
Edit bug report at http://bugs.php.net/?id=26210&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26210&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26210&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26210&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26210&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26210&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=26210&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26210&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26210&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26210&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26210&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26210&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26210&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26210&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26210&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26210&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26210&r=float