Req #38339 [Opn->Fbk]: Wanted: Find included file first in the script's path, than include_path option
Edit report at https://bugs.php.net/bug.php?id=38339&edit=1
ID: 38339
Updated by: heiglandreas@php.net
Reported by: me at daybreaker dot info
Summary: Wanted: Find included file first in the script's
path, than include_path option
-Status: Open
+Status: Feedback
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Linux Ubuntu 6.06 LTS (Server)
PHP Version: 5.1.4
Block user comment: N
Private report: N
New Comment:
Is this still relevant?
Previous Comments:
------------------------------------------------------------------------
[2006-08-05 02:46:05] me at daybreaker dot info
The feature that is included at PHP 4.0.7 by Adny still works well, but I want you to change the
search order.
If there exists foo/config2.php which prints "foo/config2.php" and add
include("config2.php"); into foo/test.php, the expected result is:
config.php
foo/config.php
foo/config2.php
and the actual result is
config.php
config.php
foo/config2.php
So there's no bug in the original feature. I just want to change the search order.
------------------------------------------------------------------------
[2006-08-05 02:10:53] me at daybreaker dot info
Description:
------------
I've found that PHP finds included files (specified by 'include',
'include_once', 'require', 'require_once' functions) first in
'include_path' option, earlier than the current script file's path.
I think it's more feasible that the first search should be done in the current script
file's path, rather than the current working directory specified in 'include_path'
option.
If there are some included files which have same name (and not same pathes), PHP simply ignores the
files who is included later in a context (or reinclude the first file when 'once' is not
specified), though there may exist some cases that someone includes files which have same names, but
are in the same directory in which the current script file is.
Reproduce code:
---------------
(Without touching 'include_path' option, it contains
'.:/usr/share/php:/usr/share/pear' by default)
* test.php
include("config.php");
include("foo/test.php");
* config.php
echo "config.php<br>";
* foo/test.php
include("config.php");
* foo/config.php
echo "foo/config.php<br>";
Expected result:
----------------
config.php
foo/config.php
Actual result:
--------------
config.php
config.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=38339&edit=1
Thread (4 messages)