ID:               38339
 User updated by:  me at daybreaker dot info
 Reported By:      me at daybreaker dot info
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Linux Ubuntu 6.06 LTS (Server)
 PHP Version:      5.1.4
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[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 http://bugs.php.net/?id=38339&edit=1

Reply via email to