Last night i was trying to push a application to my staging environment. When i noticed an error i didn’t had on my local box.
Notice: Zend_Loader::Zend_Loader::registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in /path/to/Zend/Loader.php on line 207
A quick check revealed that i had a newer version of the Zend Framework loaded on my staging environment. Locally i have 1.7x and on the staging environment i have 1.8x. And according to the documentation the old Zend_Loader is being deprecated in favor of Zend_Loader_Autoloader.
So in ZF projects prior to version 1.8x when enabling autoloading we would do something like this:
require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload();
With the new Zend_Loader_AutoLoader this will look something like this:
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Namespace_');
Notice the call to ‘registerNamespace’. This is where you set the namespacing for the classes or application libraries. By default the AutoLoader picks up Zend_ and ZendX_ namespacing. And we can extend this to use our own classes and libraries.



Thijs Lensselink is a PHP developer, consultant and all out open source enthusiast.
He has over 12+ years of experience in building and maintaining web applications mostly
on linux/Unix/BSD platforms. Besides a full time job he does freelance work with his ...