From: snowy at corporatezoo dot com
Operating system: Windows XP
PHP version: 5.2.0
PHP Bug Type: Scripting Engine problem
Bug description: Search order for include/require wrong in get_include_path
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 bug report at http://bugs.php.net/?id=39542&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39542&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39542&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39542&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39542&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39542&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39542&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39542&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39542&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39542&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39542&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39542&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39542&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39542&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39542&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39542&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39542&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39542&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39542&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39542&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39542&r=mysqlcfg