php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40231 file_exists incorrectly reports false
Submitted: 2007-01-25 08:47 UTC Modified: 2007-01-29 10:26 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: RQuadling@php.net Assigned: dmitry
Status: Closed Package: Filesystem function related
PHP Version: 5CVS-2007-01-25 (snap) OS: Windows XP SP2
Private report: No CVE-ID:
 [2007-01-25 08:47 UTC] RQuadling@php.net
Description:
------------
Latest release fails to find files using file_exists.

2 different computers, both Windows XP SP2.

In both cases the allow_url_xxx settings are the same (the only thing I can think of which may affect this).

The code was run via the command line. Copying the PHP installation from the working machine to the non-working machine results in 2 working machines. The only files altered exist within C:\PHP5. No other settings or ini files have been altered between releases.



Reproduce code:
---------------
@echo off
echo Find file using normal DOS command.
echo ===================================
dir \\bandexch\bandvulcfaxesreceived\2007\01\25\2007-01-25__00-00__Page-0001__9FNM7E.tif
echo.
echo.
echo Report PHP Version.
echo ===================
php -v
echo.
echo.
echo Find the same file using PHP's file_exists command.
echo ===================================================
php -r "var_export(file_exists('\\\\bandexch\\bandvulcfaxesreceived\\2007\\01\\25\\2007-01-25__00-00__Page-0001__9FNM7E.tif'));"


Expected result:
----------------
Find file using normal DOS command.
===================================
 Volume in drive \\bandexch\bandvulcfaxesreceived has no label.
 Volume Serial Number is 94A0-8C6D

 Directory of \\bandexch\bandvulcfaxesreceived\2007\01\25

25/01/2007  00:01            19,921 2007-01-25__00-00__Page-0001__9FNM7E.tif
               1 File(s)         19,921 bytes
               0 Dir(s)  34,604,453,888 bytes free


Report PHP Version.
===================
PHP 5.2.1RC3-dev (cli) (built: Jan 11 2007 16:24:41)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies
    with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend Technologies


Report the state of allow_url_xxx
=================================
string(1) "1"
string(1) "0"


Find the same file using PHP's file_exists command.
===================================================
true


Actual result:
--------------
Find file using normal DOS command.
===================================
 Volume in drive \\bandexch\bandvulcfaxesreceived has no label.
 Volume Serial Number is 94A0-8C6D

 Directory of \\bandexch\bandvulcfaxesreceived\2007\01\25

25/01/2007  00:01            19,921 2007-01-25__00-00__Page-0001__9FNM7E.tif
               1 File(s)         19,921 bytes
               0 Dir(s)  34,604,462,080 bytes free


Report PHP Version.
===================
PHP 5.2.1RC4-dev (cli) (built: Jan 25 2007 08:24:12)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies
    with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend Technologies


Report the state of allow_url_xxx
=================================
string(1) "1"
string(1) "0"


Find the same file using PHP's file_exists command.
===================================================
false


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-25 08:49 UTC] RQuadling@php.net
Sorry. I forgot to mention that of the 2 machines, only 1 had been upgraded to the latest snapshot and this is the machine that is not working but had been prior to the upgrade.
 [2007-01-25 09:29 UTC] dmitry@php.net
I cannot reproduce the bug. UNC patches work fine for me.
Is "\\bandexch\bandvulcfaxesreceived" a samba share?
 [2007-01-25 09:54 UTC] RQuadling@php.net
\\bandexch is a windows server and is NOT the localhost.

As a better proof of the problem.

No config. allow_url_include and allow_url_fopen both set to 1.

The command below is run in :
D:\Personal Files\Software\PHP\V5.2.latest\php5.2-win32-latest (the snapshot for 5.2.1RC4-dev) and in C:\PHP5 (an RC3 snapshot from Jan 11th).

php -n -d allow_url_include=1 -d allow_url_fopen=1 -r "var_dump(phpversion(), ini_get('allow_url_fopen'), ini_get('allow_url_include'), file_exists('\\\\bandexch\\bandvulcfaxesreceived\\2007\\01\\25\\2007-01-25__00-00__Page-0001__9FNM7E.tif'));"

Output:

string(12) "5.2.1RC4-dev"
string(1) "1"
string(1) "1"
bool(false)

and

string(12) "5.2.1RC3-dev"
string(1) "1"
string(1) "1"
bool(true)

The no config bit is important as there is no Zend Optimizer running or any extensions.

Same machine. Same security. Same user (me). I have admin rights to the LAN.
 [2007-01-26 15:16 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.

Only ZTS version was affected.
 [2007-01-29 10:26 UTC] RQuadling@php.net
Yes! Thanks.

php -n -d allow_url_include=0 -d allow_url_fopen=0 -r "var_dump(phpversion(), ini_get('allow_url_fopen'), ini_get('allow_url_include'), file_exists('\\\\bandexch\\bandvulcfaxesreceived\\2007\\01\\25\\2007-01-25__00-00__Page-0001__9FNM7E.tif'));"

outputs...

string(12) "5.2.1RC5-dev"
string(1) "0"
string(1) "0"
bool(true)

As expected.

Thanks again you wonderful people!
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 18:01:58 2014 UTC