#44293 [Fbk-Opn]: realpath does not follow Virtual directory

2008-03-06 Thread mmichel at chez dot com
 ID:   44293
 User updated by:  mmichel at chez dot com
 Reported By:  mmichel at chez dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Filesystem function related
 Operating System: Win2003
 PHP Version:  5.2.5
 New Comment:

yes there is.

Elsewhere could be accessed with ../../Elsewhere from the root
directory of the website.

Virtual Directories in IIS try to mimic symlinks, but they are not real
files that can be tracked down like symlinks. This may be the problem
determining the realpath.


Previous Comments:


[2008-03-05 09:28:21] [EMAIL PROTECTED]

So is there some path in your filesystem called Elsewhere which is
relative to the current working directory? If there is, then this is a
bug, but if there isn't, then it's not a bug.



[2008-03-03 15:03:10] mmichel at chez dot com

 Try adding the trailing slash in the directory..

No change.



[2008-03-03 14:48:34] [EMAIL PROTECTED]

Try adding the trailing slash in the directory..



[2008-03-03 14:31:58] mmichel at chez dot com

Addendum from my 3 Mar 1:56pm UTC comment:
Whilst php is able to give me the realpath of the script
http://localhost/elsewhere/test.php , asking for the realpath of
http://localhost/elsewhere in the http://localhost/local/test.php script
fails.



[2008-03-03 14:17:37] mmichel at chez dot com

@jani: typo was in the comment, not in my code. I checked :-)



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/44293

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



#44293 [Fbk-Opn]: realpath does not follow Virtual directory

2008-03-03 Thread mmichel at chez dot com
 ID:   44293
 User updated by:  mmichel at chez dot com
 Reported By:  mmichel at chez dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Filesystem function related
 Operating System: Win2003
 PHP Version:  5.2.5
 New Comment:

it returns:
string(22) C:\Inetpub\wwwroot\local 
bool(false)


Previous Comments:


[2008-03-03 13:04:43] [EMAIL PROTECTED]

What does this script output:

?php
$local='./local';
$virt='./elsewhere';

var_dump(realpath($local));
var_dump(realpath($virt));

?



[2008-02-29 15:46:00] mmichel at chez dot com

Description:

If you do a realpath('./elsewhere'), where elsewhere is a IIS virtual
directory, realpath return FALSE.

Reproduce code:
---
- Use the default site in IIS6 (root=c:\inetpub\wwwroot)
- in the root directory create a folder called local
- Create a virtual directory (either via a network share or in another
path on a local drive, e.g. C:\Elsewhere), and call it elsewhere

then

?php
$local='./local';
$virt='./elsewhere';

$check_path=realpath($local);
print ($checkpath === FALSE) ? local path not resolvedbr :
local=$check_pathbr;

$check_path=realpath($virt);
print ($checkpath === FALSE) ? virtual dir not recognizedbr :
virtual=$check_pathbr;

?

Expected result:

local=C:\Inetpub\wwwroot\local
virtual=C:\Elsewhere

Actual result:
--
local=C:\Inetpub\wwwroot\local
virtual=

Note that realpath does not return FALSE...





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



#44293 [Fbk-Opn]: realpath does not follow Virtual directory

2008-03-03 Thread mmichel at chez dot com
 ID:   44293
 User updated by:  mmichel at chez dot com
 Reported By:  mmichel at chez dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Filesystem function related
 Operating System: Win2003
 PHP Version:  5.2.5
 New Comment:

@jani:
Virtual dir is kind of a symlink handled by IIS rather than the OS.
Thus, the document_root for http://localhost/elsewhere/test.php is
different from the one for http://localhost/local/test.php

Still, browsing to http://localhost/elsewhere works, and executing
http://localhost/elsewhere/test.php works.


Previous Comments:


[2008-03-03 13:46:00] [EMAIL PROTECTED]

.
.
$check_path=realpath($virt);
print ($checkpath === FALSE) ? virtual dir not recognizedbr :
.
.

That's your code, note the tiny typo there? :)

From the manual:
realpath() returns FALSE on failure, e.g. if the file does not exist.

I don't know what these 'Virtual dirs' are in IIS, but I guess they're
not _filesystem_ things. realpath() is meant to be used with
_filesystem_..



[2008-03-03 13:45:05] mmichel at chez dot com

Moreover:
On this page http://php.uli.it/manual/hk/function.realpath.php
a comment provides this:
=8=
This is a modified version of the code written by Dave, wich finds the
absolute path of a virtual path, this function returns the absolute
path, If you have php running on IIS Plataform you could find this very
usefull

function mappath2($path) {
//this here bellow trims the last / in case it has it
If ($path{strlen($path)-1}==/){
$path = substr($path,0, strlen($path)-1);
}
$relative = str_repeat('../',substr_count($path,'/')-1);
// transforms virtual or relative path to an absolute path 
return realpath(substr($path,0,1)=='/' ? $relative.substr($path,1) :
$path); 
}

the implementation would be like this
having

$imagepath = /website001/images/catalog/;

$realpath = mappath2($imagepath);

The result in $realpath would be something like
C:\Inetpub\wwwroot\website001\images\catalog
=8=

I tried the function and it did not worked.



[2008-03-03 13:39:57] mmichel at chez dot com

it returns:
string(22) C:\Inetpub\wwwroot\local 
bool(false)



[2008-03-03 13:04:43] [EMAIL PROTECTED]

What does this script output:

?php
$local='./local';
$virt='./elsewhere';

var_dump(realpath($local));
var_dump(realpath($virt));

?



[2008-02-29 15:46:00] mmichel at chez dot com

Description:

If you do a realpath('./elsewhere'), where elsewhere is a IIS virtual
directory, realpath return FALSE.

Reproduce code:
---
- Use the default site in IIS6 (root=c:\inetpub\wwwroot)
- in the root directory create a folder called local
- Create a virtual directory (either via a network share or in another
path on a local drive, e.g. C:\Elsewhere), and call it elsewhere

then

?php
$local='./local';
$virt='./elsewhere';

$check_path=realpath($local);
print ($checkpath === FALSE) ? local path not resolvedbr :
local=$check_pathbr;

$check_path=realpath($virt);
print ($checkpath === FALSE) ? virtual dir not recognizedbr :
virtual=$check_pathbr;

?

Expected result:

local=C:\Inetpub\wwwroot\local
virtual=C:\Elsewhere

Actual result:
--
local=C:\Inetpub\wwwroot\local
virtual=

Note that realpath does not return FALSE...





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



#44293 [Fbk-Opn]: realpath does not follow Virtual directory

2008-03-03 Thread mmichel at chez dot com
 ID:   44293
 User updated by:  mmichel at chez dot com
 Reported By:  mmichel at chez dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Filesystem function related
 Operating System: Win2003
 PHP Version:  5.2.5
 New Comment:

 Try adding the trailing slash in the directory..

No change.


Previous Comments:


[2008-03-03 14:48:34] [EMAIL PROTECTED]

Try adding the trailing slash in the directory..



[2008-03-03 14:31:58] mmichel at chez dot com

Addendum from my 3 Mar 1:56pm UTC comment:
Whilst php is able to give me the realpath of the script
http://localhost/elsewhere/test.php , asking for the realpath of
http://localhost/elsewhere in the http://localhost/local/test.php script
fails.



[2008-03-03 14:17:37] mmichel at chez dot com

@jani: typo was in the comment, not in my code. I checked :-)



[2008-03-03 13:56:32] mmichel at chez dot com

@jani:
Virtual dir is kind of a symlink handled by IIS rather than the OS.
Thus, the document_root for http://localhost/elsewhere/test.php is
different from the one for http://localhost/local/test.php

Still, browsing to http://localhost/elsewhere works, and executing
http://localhost/elsewhere/test.php works.



[2008-03-03 13:46:00] [EMAIL PROTECTED]

.
.
$check_path=realpath($virt);
print ($checkpath === FALSE) ? virtual dir not recognizedbr :
.
.

That's your code, note the tiny typo there? :)

From the manual:
realpath() returns FALSE on failure, e.g. if the file does not exist.

I don't know what these 'Virtual dirs' are in IIS, but I guess they're
not _filesystem_ things. realpath() is meant to be used with
_filesystem_..



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/44293

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