#39542 [Fbk->Opn]: Search order for include_once/require_once wrong in get_include_path
| From: | snowy at corporatezoo dot com | Date: | Fri, 09 Feb 2007 05:11:00 +0000 |
| Subject: | #39542 [Fbk->Opn]: 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-108605@lists.php.net to get a copy of this message | ||
ID: 39542
User updated by: snowy at corporatezoo dot com
-Summary: Search order for include/require wrong in
get_include_path
Reported By: snowy at corporatezoo dot com
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.2.0
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
[2006-11-28 22:45:47] snowy at corporatezoo dot com
Hi any update on this? btw, in case it was confusing, that wasn't a
"fix" I posted, it is merely a way to circumvent the behaviour.
Obviously this "fix" would require the renaming of all php class files
in old code, which is an extreme pain, but it would be ok, if I could
just confirm what the new "behaviour" of includes is meant to be.
If there is not supposed to be a change in the behaviour of
includes/requires, then this is probably a bug
------------------------------------------------------------------------
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