#24251 [Opn->Ana]: include paths with include*()/require*() (again)
| From: | sniper@php.net | Date: | Tue, 24 Jun 2003 03:21:05 +0000 |
| Subject: | #24251 [Opn->Ana]: include paths with include*()/require*() (again) | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969354827@lists.php.net to get a copy of this message | ||
ID: 24251
Updated by: sniper@php.net
Reported By: qurve at qurve dot com
-Status: Open
+Status: Analyzed
-Bug Type: *Directory/Filesystem functions
+Bug Type: Documentation problem
Operating System: FreeBSD 4.7
PHP Version: 4.3.2
New Comment:
It's working just like it is supposed to be working.
The working directory (cwd) is the one for the 'main' script, a.php in
your case. NOT the directory where the 'sub' scripts are located.
Previous Comments:
------------------------------------------------------------------------
[2003-06-21 12:35:12] qurve at qurve dot com
I should also note that this behavior isn't even consistent:
+---+----------------+------------+----------------+-------------------+----------+
| # | file | includes | should include | actually includes
| correct? |
+---+----------------+------------+----------------+-------------------+----------+
| 1 | /root/a.php | b/b.php | /root/b/b.php | /root/b/b.php
| yes |
| 2 | /root/b/b.php | b2.php | /root/b/b2.php | /root/b/b2.php
| yes |
| 3 | /root/b/b2.php | ../c/c.php | /root/c/c.php | /c/c.php
| no |
+---+----------------+------------+----------------+-------------------+----------+
Behavior 1 works as it should
Behavior 2 works as it should
Behavior 3 works not as expected
Behavior 2 and 3 are inconsistent with each other.
------------------------------------------------------------------------
[2003-06-18 21:26:50] qurve at qurve dot com
Description:
------------
This was posted previously, but I did not feel the issue was really
answered by the responses and I upgraded to 4.3.2 and it's still like
this.
I'm not sure whether this is how it's supposed to work, but if it is
I'm amazed because it's extremely counter-intuitive.
'.' should always be relative to the script that is calling
include*()/require*() even if that script was include*()'d/require*()'d
itself.
full write-up here:
http://www.qurve.com/broken_paths.txt
Reproduce code:
---------------
http://www.qurve.com/broken_paths.txt
Expected result:
----------------
/root/a.php includes: "b/b.php"
/root/b/b.php includes: "../c/c.php"
php should include /root/c/c.php
Actual result:
--------------
/root/a.php includes: "b/b.php"
/root/b/b.php includes: "../c/c.php"
php attempts to include /c/c.php
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24251&edit=1