ID: 39542
User updated by: snowy at corporatezoo dot com
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:
actually I am using full paths, I'm doing a:
define('SITEROOT_DIR','/web/myproject');
define('FRAMEWORK_DIR','/web/framework');
define('SITECLASS_DIR',SITEROOT_DIR.'/_application');
set_include_path(SITECLASS_DIR.';'.FRAMEWORK_DIR.';'.get_include_path());
and /web/myproject/docroot is the docroot
(I've always been using this kind of naming with "/" for windows since
4.0.x in case I need compat)
It's almost as if it found index.php in the current namespace, and
decides it doesn't need to go to include_path to look for one? just
guessing...
Previous Comments:
------------------------------------------------------------------------
[2006-11-17 15:25:31] [EMAIL PROTECTED]
What if you change "../classes" to the full path?
------------------------------------------------------------------------
[2006-11-17 14:11:09] [EMAIL PROTECTED]
I didn't use your example, I tested it in another way.
------------------------------------------------------------------------
[2006-11-17 14:05:26] snowy at corporatezoo dot com
tony, sorry I just realised that example might be different in linux
because of being case sensitive.
could you try renaming the files and class name to "index"... ie,
"../classes/index.php" and "class index".
See which one it tries to load up first. thx
------------------------------------------------------------------------
[2006-11-17 11:35:53] [EMAIL PROTECTED]
Not reproducible on Linux.
------------------------------------------------------------------------
[2006-11-17 06:24:25] snowy at corporatezoo dot com
Description:
------------
Behaviour of require/include different to < 5.2.0.
I'm not sure if this is by design, couldn't find any reference to it in
release notes. Basically, the search order of an include seems to always
start with ./ instead of in the order of get_include_path(). This is
problematic, esp in the case of using autoload, where a filename eg in
./index.php might be the same as ../classes/Index.php, ./index.php gets
autoloaded instead of ../classes/Index.php
Reproduce code:
---------------
//index.php
set_include_path('../classes;.');
function __autoload($class)
{
if (!require_once($class.'.php')) {
error_log('Error: Autoload class: '.$class.' not found!');
}
}
$index = new Index();
//../classes/Index.php
class Index
{
//blah
}
Expected result:
----------------
In 5.1.6, it works ok, loads Index.php
Actual result:
--------------
in 5.2.0,
Fatal error: Class 'Index' not found in c:\docroot\index.php
I suspect it's looking for a class in index.php (Which is the currently
executed script).
Is this an architectural change? Or is this a bug?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39542&edit=1