From: gabe at mudbuginfo dot com
Operating system: linux 2.4.26
PHP version: 4.3.9
PHP Bug Type: *Directory/Filesystem functions
Bug description: include fails to open file from parent directory of include path
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 bug report at http://bugs.php.net/?id=30437&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30437&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30437&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30437&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30437&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30437&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30437&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30437&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30437&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30437&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30437&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30437&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30437&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30437&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30437&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30437&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30437&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30437&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30437&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30437&r=mysqlcfg