From: tayloj1 at uk dot ibm dot com
Operating system:
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: include_path is applied only to cwd, not the current script
directory
Description:
------------
The include_path is applied only to the current working directory, not the
current script directory.
The statement
"Files for including are first looked in include_path relative to the
current working directory and then in include_path relative to the
directory of current script. "
is contradicted by the following experiment (tested on Windows and php
5.2.2):
Reproduce code:
---------------
Directory layout:
\myScriptDir
\a.php <?php include 'b.php' ?>
\myWorkingDir
\php.exe
\php.ini [...] include_path='include1;include2' [...]
Execute:
\myWorkingDir> php \myScriptDir\a.php
Expected result:
----------------
Expected attempted file reads (if the documentation were correct):
"Files for including are first looked in include_path relative to the
current working directory..."
\myWorkingDir\include1\b.php
\myWorkingDir\include2\b.php
"...and then in include_path relative to the directory of current script"
\myScriptDir\include1\b.php
\myScriptDir\include2\b.php
Actual result:
--------------
Actual attempted file reads:
\myWorkingDir\include1\b.php
\myWorkingDir\include2\b.php
\myScriptDir\b.php
Obtained by stepping through the code with a debugger (namely
_php_stream_fopen_with_path() in plain_wrapper.c) and confirmed with
processmonitor, a tool which can monitor filesystem activity
(http://www.microsoft.com/technet/sysinternals/utilities/processmonitor.mspx)
The documentation should read:
"Files for including are first looked for in each include_path entry
relative to the current working directory, and then in the directory of
current script."
Note: the documentation provides an example after the offending statement.
That example holds true against the actual behaviour of the engine, because
the include path is just '.'.
--
Edit bug report at http://bugs.php.net/?id=41460&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41460&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41460&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41460&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41460&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41460&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41460&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41460&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41460&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41460&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41460&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41460&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41460&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41460&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41460&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41460&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41460&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41460&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41460&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41460&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41460&r=mysqlcfg