#48173 [NEW]: file_exists fails to find in include_path when using __autoload
| From: | kevinpeno at gmail dot com | Date: | Wed, 06 May 2009 23:54:37 +0000 |
| Subject: | #48173 [NEW]: file_exists fails to find in include_path when using __autoload | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-136902@lists.php.net to get a copy of this message | ||
From: kevinpeno at gmail dot com
Operating system: Windows Server 2008
PHP version: 5.2.9
PHP Bug Type: Filesystem function related
Bug description: file_exists fails to find in include_path when using __autoload
Description:
------------
Using file_exists fails to find valid files within include_path when using
an __autoload. Removing file_exists() the required file is found and
loaded.
Safe mode is not enabled.
Reproduce code:
---------------
<?php
function __autoload( $classname )
{
$file = str_replace( '_', DIRECTORY_SEPARATOR, $classname ).'.php';
if( file_exists( $file ) )
{
require( $file );
return true;
}
else
{
return FALSE;
}
}
# Sets include path to the current directory just for easy testing.
set_include_path( realpath( dirname(__FILE__)
).DIRECTORY_SEPARATOR.PATH_SEPARATOR.get_include_path() );
$test = new Prefix_ClassName();
?>
Expected result:
----------------
File included class initialized.
Actual result:
--------------
Fatal error: Class 'Prefix_ClassName' not found.
--
Edit bug report at http://bugs.php.net/?id=48173&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48173&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48173&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48173&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48173&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48173&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48173&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48173&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48173&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48173&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48173&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48173&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48173&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48173&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48173&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48173&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48173&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48173&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48173&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48173&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48173&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48173&r=mysqlcfg