|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-08-05 02:10 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 14 23:00:01 2025 UTC |
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.