From: pear at laurent-laville dot org
Operating system: Windows XP
PHP version: 4.4.2
PHP Bug Type: Filesystem function related
Bug description: file_exists strange behavior on windows platform only
Description:
------------
Concat directory name without trailing dir separator, and a file name.
While i was ready to prepare a new release of PEAR_PackageFileManager
(PFM), and generate the new package.xml, i found a bug. I thought first it
was from PFM, but then i investigate a bit more, and i found :
It will occurs only under Windows platform, because it works fine under
Unix.
I have :
- this "E:\pearix-dev\pfm15x" directory exists
- this "E:\pearix-dev\pfm15xpackage.xml" (file | dir) does not exists
- my test script into "E:\pearix-dev\pfm15x" directory
Tested under PHP 5.1.4 and PHP 4.4.2 under windows, with Apache 2.0.55
gave WRONG results
Tested under PHP 5.1.4 and PHP 4.4.0 under Unix with Apache 2.2.2 gave
GOOD (expected) results.
Feedback are welcome !
Laurent Laville
Reproduce code:
---------------
<?php
$outputdir = dirname(__FILE__); // "E:\pearix-dev\pfm15x"
$packagefile = 'package.xml';
var_dump($outputdir);
var_dump($outputdir . $packagefile);
if (file_exists($outputdir . $packagefile)) {
var_dump('condition 1 passed');
}
if (is_writable($outputdir . $packagefile)) {
var_dump('condition 2 passed');
}
if ((file_exists($outputdir . $packagefile) &&
is_writable($outputdir . $packagefile))) {
var_dump('condition 3 passed');
}
?>
Expected result:
----------------
None of "condition x passed" message displayed, but only
string(20) "E:\pearix-dev\pfm15x"
string(31) "E:\pearix-dev\pfm15xpackage.xml"
Actual result:
--------------
The 3 conditons are TRUE
string(20) "E:\pearix-dev\pfm15x"
string(31) "E:\pearix-dev\pfm15xpackage.xml"
string(18) "condition 1 passed"
string(18) "condition 2 passed"
string(18) "condition 3 passed"
--
Edit bug report at http://bugs.php.net/?id=37687&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37687&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=37687&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37687&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37687&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37687&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37687&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37687&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37687&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37687&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37687&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37687&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37687&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37687&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37687&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37687&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37687&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37687&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37687&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37687&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37687&r=mysqlcfg