php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37687 file_exists strange behavior on windows platform only
Submitted: 2006-06-03 13:52 UTC Modified: 2006-08-15 14:04 UTC
From: pear at laurent-laville dot org Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.1.4, 4.4.2 OS: win32 only
Private report: No CVE-ID: None
 [2006-06-03 13:52 UTC] pear at laurent-laville dot org
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"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-14 21:58 UTC] nlopess@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

I can't reproduce it.
 [2006-08-15 14:04 UTC] pear at laurent-laville dot org
Now my configuration is Apache 2.0.58 + PHP 5.1.4 / PHP 4.4.2

I'm sorry but i can't reproduce it myself.
With your PHP 5.2.0RC2 snapshot (of course), but even after re-installed a platform with Apache 2.0.55 (difference from my previous config).

Perharps the problem came to another source but i don't know  now what it could be ?!

Sorry again 
I'll close this bug 

regards
Laurent Laville
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 07 11:01:31 2024 UTC