2009年6月6日星期六

[fw-mvc] Regression with Autoloading?

I had been including my own autoloader for PHP 5.3 style classes (my understanding is that somebody is going to be adding this to PHP 5.3 itself at some point), and now after I updated my svn:externals for ZF (rev 15923), my app stopped working. It seems that when I call Zend_Loader_Autoloader::registerNamespace, this autoloader wants to take over all the other autoloaders or something like that...

Allow me to demonstrate.

This code works:

require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();

function autoload($class) {
    $class = str_replace('\\', '/', $class);
    include $class . '.php';
}

spl_autoload_register('autoload');
$a = new Zend_Acl;
$b = new My\Class;


but if I add $autoloader->registerNamespace('AB');

all of a sudden my autoload function is ignored!



没有评论: