From:             davi dot fol at gmail dot com
Operating system: Mac OSX 10.6
PHP version:      5.3.1
PHP Bug Type:     Dynamic loading
Bug description:  spl_autoload is broken

Description:
------------
I am aware of spl_autoload_* issues that the development team do not 
consider bugs, namely the requirement for class files to have 
lowercase names in order for spl_autoload to function. (I would like 
to think that moving forwards, we could supply a constant to 
spl_register_autoload as a best compromise BC step to change this 
behaviour to support PascalCase class names).

Anyhow, I've disabled all extensions, I believe I've exhausted all 
configuration possibilities affecting spl_autoloads behaviour, and 
it still does not work. Defining my own handler, does. It seems that 
no matter how I define the include path, spl_autoload throws 
LogicExceptions as it cannot find classes. I am hoping that its not 
the case that as Mac OSX paths contain upper case folder names, 
that the auto lowercasing behaviour of spl_autoload is affecting 
absolute paths.

As a concrete case, this IS an include path that I use- it works with 
include_once et al, supplying or omitting the trailing slash:

"/Users/davidfoley/Documents/Aptana Studio 
Workspace/www.thorium.site/Private/Library/"

The above path is a perfectly valid file path- its somewhat different 
in the sense that 'www.thorium.site' is plonked in the middle- 
thats simply the name of a virtual hosts symlinked folder. I am only 
guessing that this could be a possible reason why spl_autoload is 
not working.

Reproduce code:
---------------
Assume a class file: 
location:
www/Private/library/target.php
contents:
namespace library
{
    class target
    {

    }
}

Assume a bootloader script
location:
www/Public/boot.php
contents:
define('BREAK', '<br/>');
set_include_path('absolute/path/to/www/Private/library);
spl_autoload_extensions('.php');
spl_autoload_register();

$classFile= new SplFileObject('library/target.php', true);
echo 'The class file exists: ' . ($classFile->isFile() ? 'true' : 'false')
. BREAK;

use library\target;

$instance= new target;
echo 'The class was loaded: ' . (isset($instance) ? 'true' : 'false') .
BREAK;

Expected result:
----------------
The following output:

The class file exists: true
The class was loaded: true

Actual result:
--------------
LogicException 'could not load class library\target'

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

Reply via email to