#31054 [NEW]: include_path is not traversed fully when open_basedir has a nonmatching entries
| From: | kameshj at fastmail dot fm | Date: | Fri, 10 Dec 2004 15:14:12 +0000 |
| Subject: | #31054 [NEW]: include_path is not traversed fully when open_basedir has a nonmatching entries | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70017@lists.php.net to get a copy of this message | ||
From: kameshj at fastmail dot fm
Operating system: Any Operating System
PHP version: 5.0.2
PHP Bug Type: Scripting Engine problem
Bug description: include_path is not traversed fully when open_basedir has a nonmatching entries
Description:
------------
include_path is not traversed fully when open_basedir have a nonmatching
entries with respect to include_path entries matching from the beginning.
For example:
include_path=/kameshj:/usr/local/lib/php/includes
open_base_dir=/mageshj:/usr/local/lib/php/includes
Even though I have "include.php" under /usr/local/lib/php/includes and
/usr/local/lib/php/includes is also under open_basedir include fails
because of open_basedir check.
Analysed the cause and found the cause to be
_php_stream_fopen_with_path in
php-src/main/streams/plain_wrapper.c
In this function
php_check_open_basedir is called for each include_path_entry/filename if
for any of the include_path it fails further include_path is not tried at
all.
Attaching the patch at
http://puggy.symonds.net/~kameshj/incpath.patch
Reproduce code:
---------------
main.php
<?php
echo __FILE__;
echo "\n";
include(include.php);
echo "\n";
?>
include.php
<?php
echo __FILE__;
?>
Keep this include.php in a second entry the include path for example keep
this include.php in /my/inc and have include_path as
"/non/existent:/my/inc"
Make sure this "/non/existent" is not present in open_basedir and run
main.php.
Expected result:
----------------
main.php should include 'include.php' successfully.
Actual result:
--------------
You will get a include failure message and whole host of open_basedir
failure messages.
--
Edit bug report at http://bugs.php.net/?id=31054&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31054&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31054&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31054&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31054&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31054&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31054&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31054&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31054&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31054&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31054&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31054&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31054&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31054&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31054&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31054&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31054&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31054&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31054&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31054&r=mysqlcfg