#20452 [Opn->Bgs]: Problems requiring/including when original file is a symlink
| From: | iliaa@php.net | Date: | Mon, 18 Nov 2002 00:06:28 +0000 |
| Subject: | #20452 [Opn->Bgs]: Problems requiring/including when original file is a symlink | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-25133@lists.php.net to get a copy of this message | ||
ID: 20452
Updated by: iliaa@php.net
Reported By: pupeno@pupeno.com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux Mandrake 9.0
PHP Version: 4.2.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
When including a file, it is included based on the directory you are
currently in. If that directory was /var/php/scripts/ , then all
relative paths will be calculated based on that directory.
Previous Comments:
------------------------------------------------------------------------
[2002-11-17 00:17:26] pupeno@pupeno.com
I don't have a 'working' on line example to show you this and I
don't have posibilities to do it right now, I'm sorry, but I'll try to
show you here what I mean with an example.
Let's supouse I have one script in this file
/var/php/scripts/index.php
and I have a symlink to that file like this
/var/www/htdocs/index.php -> ../../php/scripts/index.php
and this file contains the following:
<?php
require("dir/include.php");
require("../dir/include.php");
?>
When I run it, for require("dir/include.php"); it tryes to include
/var/php/scripts/dir/include.php (the relative path from the
original location of the file) but for require("../dir/include.php");
it
tryes to icnlude /var/www/dir/include.php (real path for
/var/www/htdocs/../dir/include.php) (it is resolving the relative
path from the symlink and not the original file).
I'm not sure with behaviour is the right one, but this mix is not
the right one for sure, I think.
I hope it helps, if you need more help, just contact me.
Thank you.
------------------------------------------------------------------------
[2002-11-16 11:48:31] iliaa@php.net
Could you show an example of what you mean?
------------------------------------------------------------------------
[2002-11-15 17:35:13] pupeno@pupeno.com
I'm requesting a page, the file that is called is
index.php, but this file is a symlink from somewhere else.
When I require a file from index.php, if there's no '..'
(dots) on the path (a relative path, but not going back),
the relative path is from where the original file is, but
if there are '..' on the path, the relative path is
from where the symlink is (although php identifies the
script as the original file in the error message).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20452&edit=1