#29949 [Opn->Fbk]: Relative include() sometimes works as expected
| From: | sniper@php.net | Date: | Sun, 12 Dec 2004 15:18:17 +0000 |
| Subject: | #29949 [Opn->Fbk]: Relative include() sometimes works as expected | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70076@lists.php.net to get a copy of this message | ||
ID: 29949
Updated by: sniper@php.net
Reported By: joaquim at telia dot com
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: WinXP
PHP Version: 4.3.8
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2004-09-27 11:53:22] joaquim at telia dot com
I guess this is an obvious mistake, but in "Expected result", it's
supposed to say "spoon" instead of "foo".
------------------------------------------------------------------------
[2004-09-02 13:34:37] joaquim at telia dot com
Description:
------------
If include_path is set to ".", and the relative path in an include
statement contains "../" but doesn't start with "../", then the
relative path is relative to the including script instead of the
currently running script. This is inconsistent with the way in which
relative paths in include statements are supposed to work.
Reproduce code:
---------------
/a.php
<?
include "inc/module/b.php";
?>
/inc/module/b.php
<?
include "spoon/../../c.php"; // Note: There is no "spoon" catalog
?>
/inc/c.php
<?
echo "Hello world";
?>
Expected result:
----------------
"Warning: main(foo/../../c.php): failed to open stream: No such file or
directory in /inc/module/b.php on line 1"
The above result would be consistent with the error reported when
"foo/../" is removed from the code.
Actual result:
--------------
Outputs "Hello world" to the browser.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29949&edit=1