From:             joaquim at telia dot com
Operating system: WinXP
PHP version:      4.3.8
PHP Bug Type:     Scripting Engine problem
Bug description:  Relative include() sometimes works as expected

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 bug report at http://bugs.php.net/?id=29949&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=29949&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29949&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29949&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=29949&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=29949&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=29949&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=29949&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=29949&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=29949&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=29949&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=29949&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=29949&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=29949&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=29949&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=29949&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=29949&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=29949&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=29949&r=float

Reply via email to