ID: 41460
Updated by: [EMAIL PROTECTED]
Reported By: tayloj1 at uk dot ibm dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2007-05-21 14:54:17] tayloj1 at uk dot ibm dot com
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 this bug report at http://bugs.php.net/?id=41460&edit=1