ID:               48746
 Comment by:       phpstuff at cresstone dot com
 Reported By:      ddkees at illinois dot edu
 Status:           Feedback
 Bug Type:         Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:      5.3.0
 Assigned To:      pajoye
 New Comment:

Using junctions: is_file and file_exists are giving incorrect behavior
(false on files). is_dir as well, false on directories in the junction
and the junction itself.

The same functions are working well with symlinks.

If you need testing for this, you have mail.


Previous Comments:
------------------------------------------------------------------------

[2009-09-04 20:45:25] paj...@php.net

@[4 Sep 8:20pm UTC] phpstuff at cresstone dot com

Using is_dir and is_file or file_exists and the cases you described,
does it work? (I don't think the filetype issue is related to what we
discuss here).

------------------------------------------------------------------------

[2009-09-04 20:20:02] phpstuff at cresstone dot com

I was able replicate shoresofnowhere's behavior using windows 7...


I created a junction to a folder on another drive; running is_file() on
a file inside that junction returned false, as did is_dir(). Curious to
see what php thought it was looking at, I tested filetype(), which threw
an error.

I then tested symlinks in the same manner, and got good behavior.
Symlinks seem to be a good workaround for this issue.

Test log follows:


C:\mnt\test>mklink /J junction_otherDrive f:\downloads
Junction created for junction_otherDrive <<===>> f:\downloads

C:\mnt\test>mklink /D symlink_otherDrive f:\downloads
symbolic link created for symlink_otherDrive <<===>> f:\downloads

C:\mnt\test>dir
 Volume in drive C is coreI7_System
 Volume Serial Number is 38E2-2B62

 Directory of C:\mnt\test

2009.09.04  16.05    <DIR>          .
2009.09.04  16.05    <DIR>          ..
2009.09.04  16.05    <JUNCTION>     junction_otherDrive [f:\downloads]
2009.09.04  16.05    <SYMLINKD>     symlink_otherDrive [f:\downloads]
               0 File(s)              0 bytes
               4 Dir(s)  30,034,223,104 bytes free

C:\mnt\test>php -r var_dump(filetype('junction_otherdrive'));
PHP Warning:  filetype(): Lstat failed for junction_otherdrive in
Command line code on line 1

Warning: filetype(): Lstat failed for junction_otherdrive in Command
line code on line 1
bool(false)

C:\mnt\test>php -r
var_dump(filetype('junction_otherdrive\php-5.2.0-win32-installer.msi'));
PHP Warning:  filetype(): Lstat failed for
junction_otherdrive\php-5.2.0-win32-installer.msi in Comm
and line code on line 1

Warning: filetype(): Lstat failed for
junction_otherdrive\php-5.2.0-win32-installer.msi in Command l
ine code on line 1
bool(false)

C:\mnt\test>php -r var_dump(filetype('symlink_otherdrive'));
string(3) "dir"

C:\mnt\test>php -r
var_dump(filetype('symlink_otherdrive\php-5.2.0-win32-installer.msi'));
string(4) "file"

------------------------------------------------------------------------

[2009-09-04 18:32:33] paj...@php.net

Ignore my last two comments, it works perfectly using what you
describe. I was testing it from another VM where this junction did not
exist.

I added a include 'dir3/two.php' to one.php, two.php being a simple
echo "two.php"
The output:

C:\test>\php53\debug_ts\php.exe -n one.php
two.php
bool(true)

C:\test>junction dir3
....

C:\test\dir3: JUNCTION
   Substitute Name: e:\test


C:\test>dir dir3
 ...
09/04/2009  07:33 PM                24 two.php
               1 File(s)             24 bytes
               2 Dir(s)     202,975,232 bytes free


------------------------------------------------------------------------

[2009-09-04 17:50:34] paj...@php.net

Please note that it is again a XP/2k3 only issue. Debugging/fixing now.

------------------------------------------------------------------------

[2009-09-04 17:36:30] paj...@php.net

@shoresofnowhere at gmail dot com

ok, I can reproduce it now. I will come back as soon as I have a fix.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/48746

-- 
Edit this bug report at http://bugs.php.net/?id=48746&edit=1

Reply via email to