ID:               48746
 Comment by:       shoresofnowhere at gmail 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:

@ pajoye:

Sorry, but i don't understand why the correct behaviour should be that
of 5.3:

dir1 directory
subdir1 subdirectory of dir1
cfg.php file in dir1

dir2 directory
cfg.php file in dir2
junction1 junction to subdir1 created in dir2

and i have in dir1/subdir1/file.php:
        require_once("../cfg.php");

I expect that if i run dir1/subdir1/file.php i get
        require_once("dir1/cfg.php");

BUT if i run dir2/subdir1/file.php i will get
        require_once("dir2/cfg.php");

Could you please tell me why this would be wrong? File inclusions have
always been relative to the path of the main php file that's
executing...

Thanks!


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

[2009-08-30 11:17:07] paj...@php.net

Found the problems, the windows port of dirent (scandir) as well as
php_mkdir (used by mkdir()) lack a call to realpath, making them use the
current path with the standard API. It ends to use c:.

Testing the patch but it should do it for RC1 next Tuesday. You can
test the patch yourself by calling realpath manually:

scandir(realpath('mounted_volume')); or
mkdir(realpath('mounted_volume\\test34'));

Other files operations work as expected.

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

[2009-08-30 10:39:21] paj...@php.net

Using different drives work fine here (ie. G, Z or whatever else).

Did you test it using CLI? And running each test separately or using
one single script with all tests (stat cache will be used in this
case)?

Which windows version?



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

[2009-08-30 04:41:30] phpstuff at cresstone dot com

Hmmm. may have spoke too soon. Getting some weird results when working
with mounted volumes.

'C:\mnt\test\mounted_volume' is a junction mounted volume that is *not*
the system drive ie: not c:\

Take the following sequence of commands, working directory is
'C:\mnt\test\':

is_dir('mounted_volume'); 
Returns true, yay!

scandir('mounted_volume'); 
Here's the strange behavior; this command enumerates the root system
drive, c:\, rather than the correct pointed-to volume.

mkdir('mounted_volume\test34'); 
Returns true, but test32 is created on the incorrect volume: c:\test32
now exists

is_dir('mounted_volume\test34');
Returns FALSE, this is the correct behavior because the directory does
not exist in the correct location, but it is obviously inconsistent with
the above mkdir

unlink('mounted_volume\test34');
Throws a 'No such file or directory' warning. Appears to be looking in
the correct place.

My previous tests all used c:\ as the 'mounted volume' which is why I
didn't see this at first.

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

[2009-08-30 03:30:14] phpstuff at cresstone dot com

Latest snapshot give correct behavior for me. Thanks much.

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

[2009-08-30 02:09:06] paj...@php.net

@shoresofnowhere at gmail dot com
It is not correct, the correct behavior is relative to the target of
the link/junction, as it is on any other supported platforms with link
support. It was not the case in 5.2 but php did not support links
correctly (no link at all, and only partially for junction or mounted
drive).

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

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