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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
30 + 14 = ?
Subscribe to this entry?

 
 [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: Mon Apr 29 11:01:32 2024 UTC