php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29949 Relative include() sometimes works as expected
Submitted: 2004-09-02 13:34 UTC Modified: 2004-12-21 07:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: joaquim at telia dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.3.8 OS: WinXP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: joaquim at telia dot com
New email:
PHP Version: OS:

 

 [2004-09-02 13:34 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-27 11:53 UTC] 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-12-21 07:42 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC