#48173 [Opn]: file_exists fails to find in include_path when using __autoload

From: Date: Wed, 06 May 2009 23:56:22 +0000
Subject: #48173 [Opn]: file_exists fails to find in include_path when using __autoload
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136903@lists.php.net to get a copy of this message
ID: 48173 User updated by: kevinpeno at gmail dot com Reported By: kevinpeno at gmail dot com Status: Open Bug Type: Filesystem function related Operating System: Windows Server 2008 PHP Version: 5.2.9 New Comment: I'm using windows build 5.2.9-2 NTS. This option was not selectable. Previous Comments: ------------------------------------------------------------------------ [2009-05-06 23:54:36] kevinpeno at gmail dot com 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 this bug report at http://bugs.php.net/?id=48173&edit=1

« previous php.bugs (#136903) next »