From:             lists at reptiliannature dot org
Operating system: Linux 2.6.28-15
PHP version:      5.3.0
PHP Bug Type:     SPL related
Bug description:  spl_autoload not auto loading

Description:
------------
I have been trying to use spl_autoload() to load a class located in the
same folder. My include path is set to ".".  The class file exists in the
same folder, and the class has the same name as the file without the .php
extension.

The loading does not work. 

Reproduce code:
---------------
File test.php
<?php
set_include_path('.');
var_dump(get_include_path());

$className = 'ClassA';
spl_autoload($className);
$ins = new $className;
echo $ins->val.'<br>';

?>
File ClassA.php
<?php class ClassA { var $val = 'Hello from class "ClassA"'; } ?>

Expected result:
----------------
string(1) "."

Hello from class "ClassA"

Actual result:
--------------
string(1) "."

Fatal error: Uncaught exception 'LogicException' with message 'Class
ClassA could not be loaded' in
/home/michael/src/php/tests/spl_autoload/test.php:7
Stack trace:
#0 /home/michael/src/php/tests/spl_autoload/test.php(7):
spl_autoload('ClassA')
#1 {main}
  thrown in /home/michael/src/php/tests/spl_autoload/test.php on line 7


-- 
Edit bug report at http://bugs.php.net/?id=49674&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49674&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49674&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49674&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49674&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49674&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49674&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49674&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49674&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49674&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49674&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49674&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49674&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49674&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49674&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49674&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49674&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49674&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49674&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49674&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49674&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49674&r=mysqlcfg

Reply via email to