ID: 30437
Updated by: [EMAIL PROTECTED]
Reported By: gabe at mudbuginfo dot com
-Status: Open
+Status: Closed
Bug Type: *Directory/Filesystem functions
Operating System: linux 2.4.26
PHP Version: 4.3.9
New Comment:
Same as #30881, which is already documented.
Previous Comments:
------------------------------------------------------------------------
[2004-10-14 22:22:51] gabe at mudbuginfo dot com
Easier test case:
Say for example, your include path is: /usr/local/lib/
php (most people have this or something similar)
<?php
echo "including normal DB\n";
include 'DB.php';
echo "including ../php DB\n";
include '../php/DB.php';
?>
The second include statement will fail with:
including normal DB
including ../php DB
Warning: main(../php/DB.php): failed to open stream: No
such file or directory in /tmp/x.php on line 5
Warning: main(): Failed opening '../php/DB.php' for
inclusion (include_path='.:/usr/local/lib/php:/usr/
local/lib/mis:/usr/local/lib/eclipse') in /tmp/x.php on
line 5
------------------------------------------------------------------------
[2004-10-14 22:06:53] gabe at mudbuginfo dot com
Note, open_basedir is not set anywhere for this site.
------------------------------------------------------------------------
[2004-10-14 18:23:32] gabe at mudbuginfo dot com
Description:
------------
This site prepends the full path to the site's directory
for site-specific include files with the following code
in the file /files/client/
global_fellowship_search/proto1/include/init.php
$site_include_path = dirname(__FILE__);
$sys_include_path = ini_get('include_path');
ini_set('include_path', $site_include_path . ':' .
$sys_include_path);
which creates an include path of '/files/
client/global_fellowship_search/proto1/include:.:/usr/
local/lib/php:/usr/local/lib/mis:/usr/local/lib/
eclipse'
When attempting to include the file /files/
client/global_fellowship_search/proto1/mail/
forgot_pass.mail relative to the site's prepended
include directory with "include_once '../mail/
forgot_pass.mail';", PHP fails to find the file.
Supplying an absolute path to the file works. It just
seems like PHP will not respect crawling up a '..'
parent directory link for any path within the
include_path except for '.'
Note that this code was placed in the 'index2.php' file
just for simplicity in demonstration; in implementation
this inclusion code is held within another file in the
include/ directory which is included several different
directory levels.
Reproduce code:
---------------
(Within /files/client/
global_fellowship_search/proto1/index2.php)
include_once '../mail/forgot_pass.mail';
Expected result:
----------------
Inclusion of /files/client/
global_fellowship_search/proto1/mail/forgot_pass.mail
Actual result:
--------------
Warning: main(../mail/forgot_pass.mail): failed to open
stream: No such file or directory in /files/client/
global_fellowship_search/proto1/index2.php on line 5
Warning: main(): Failed opening '../mail/
forgot_pass.mail' for inclusion (include_path='/files/
client/global_fellowship_search/proto1/include:.:/usr/
local/lib/php:/usr/local/lib/mis:/usr/local/lib/
eclipse') in /files/client/global_fellowship_search/
proto1/index2.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30437&edit=1