#39542 [Com]: Search order for include_once/require_once wrong in get_include_path
| From: | jsnell at e-normous dot com | Date: | Tue, 13 Feb 2007 16:42:03 +0000 |
| Subject: | #39542 [Com]: Search order for include_once/require_once wrong in get_include_path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108814@lists.php.net to get a copy of this message | ||
ID: 39542
Comment by: jsnell at e-normous dot com
Reported By: snowy at corporatezoo dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.2.0
New Comment:
still fails for me in the latest snapshot:
One other thing to note, it functions differently depending on where
you call the script from:
e-normous:/Users/jsnell/delete/php5/testcase/lib$
../../../php5.2-200702131330/sapi/cli/php ../test.php
/Users/jsnell/delete/php5/testcase/lib/
Included Test from lib/
vs.
e-normous:/Users/jsnell/delete/php5/testcase$
../../php5.2-200702131330/sapi/cli/php ./test.php
/Users/jsnell/delete/php5/testcase/lib/
and
e-normous:/Users/jsnell/delete/php5/testcase$
../../php5.2-200702131330/sapi/cli/php test.php
/Users/jsnell/delete/php5/testcase/lib/
Previous Comments:
------------------------------------------------------------------------
[2007-02-09 05:11:00] snowy at corporatezoo dot com
hi tried the windows snap, also just tried 5.2.1 and same problem.
I'll just confirm with jsnell's observation that it is indeed
require_once that is throwing that exception.
require seems to work fine.
ie
function __autoload($class)
{
require_once($class . '.php');
}
breaks
whilst
function __autoload($class)
{
require($class . '.php');
}
works
------------------------------------------------------------------------
[2007-02-05 14:01:19] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2007-02-02 22:22:26] snowy at corporatezoo dot com
oh so maybe the search order is different between require and
require_once?
hmmm makes senses since it looks like a namespace caching issue.
------------------------------------------------------------------------
[2007-02-02 22:02:34] jsnell at e-normous dot com
Test case:
Create a file called test.php with the following:
<?php
set_include_path(dirname(__FILE__).'/lib/');
echo(get_include_path()."\n");
require_once('test.php');
?>
and create a subdirectory called lib, containing a file called test.php
with the following contents:
Included Test from lib/
Results with php 4 (PHP 4.4.4 (cli) (built: Nov 1 2006 18:10:56) --
osx 10.4.x:
/Users/jsnell/delete/php5/testcase/lib/
Included Test from lib/
Results with PHP 5.1.4 (PHP 5.1.4 (cli) (built: Jan 25 2007 11:50:25)
):
php5 test.php
/Users/jsnell/delete/php5/testcase/lib/
Included Test from lib/
Results with PHP CVS (anon checked out on February 2nd):
../sapi/cli/php test.php
/Users/jsnell/delete/php5/testcase/
--
I believe the original submission is wrong, by changing require_once()
to require(), the file from lib/ is being loaded.
------------------------------------------------------------------------
[2007-02-02 16:48:00] jsnell at e-normous dot com
Also seeing this in: PHP 5.2.0-8 (cli) (built: Dec 17 2006 20:03:51)
using Linux relay 2.4.29 #2 SMP Sat Mar 12 13:17:01 CST 2005 i686
GNU/Linux
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39542
--
Edit this bug report at http://bugs.php.net/?id=39542&edit=1