#41486 [Opn->Csd]: include_path ignored if file starts with ./ or ../

From: Date: Sun, 27 May 2007 09:46:42 +0000
Subject: #41486 [Opn->Csd]: include_path ignored if file starts with ./ or ../
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969376469@lists.php.net to get a copy of this message
ID: 41486 Updated by: colder@php.net Reported By: tayloj1 at uk dot ibm dot com -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: colder 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-26 13:30:35] ezyang@php.net I haven't verified, but here's a patch if the behavior is indeed correct (I'm inclined to believe this reporter, but there's no harm in double-checking): Index: en/language/control-structures.xml =================================================================== RCS file: /repository/phpdoc/en/language/control-structures.xml,v retrieving revision 1.138 diff -u -r1.138 control-structures.xml --- en/language/control-structures.xml 7 May 2007 09:33:54 -0000 1.138 +++ en/language/control-structures.xml 26 May 2007 13:28:46 -0000 @@ -1308,7 +1308,7 @@ in that file, <filename>b.php</filename> is first looked in <filename class="directory">/www/</filename> and then in <filename class="directory">/www/include/</filename>. If filename begins with <literal>./</literal> or <literal>../</literal>, it - is looked only in include_path relative to the current working directory. + is only looked for relative to the current working directory. </simpara> <simpara> When a file is included, the code it contains inherits the ------------------------------------------------------------------------ [2007-05-24 09:55:07] tayloj1 at uk dot ibm dot com Description: ------------ ref: http://uk.php.net/include/ If the file for including starts with ./ or ../, include_path is not taken into account. The statement: "If filename begins with ./ or ../, it is looked only in include_path relative to the current working directory. " should be replaced with: "If the filename begins with ./ or ../, it is only looked for relatively to the current working directory." as demonstrated 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: ---------------- Doc says: "it is looked only in include_path relative to the current working directory" Expected attempted file reads (if the documentation were correct): \myWorkingDir\include1\b.php \myWorkingDir\include2\b.php Actual result: -------------- Actual attempted file reads: \myWorkingDir\b.php Result 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) So files were only looked for relatively to the current working directory and the include path was not taken into account. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41486&edit=1

« previous php.doc (#969376469) next »