Issues

ZF-981: Add autoload() method to Zend_Loader class

Description

Add an spl_autoload()-compatible autoload() method to the Zend class to make a drop-in callback for autoloading possible. Usage should be:


spl_autoload_register(array('Zend', 'autoload'));

This can be accomplished by wrapping calls to Zend::loadClass() in a try/catch block, and returning false if an exception has bee caught.

Comments

Assign to Matthew.

See [[http://framework.zend.com/wiki/display/…]]

Nico's idea is:


<?php
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
?>

I like this. Alternately, it could just be {{Zend_Loader::autoload()}}.

The Zend.php file is being deprecated and will be removed by ZF 1.0. So if we implement an autoload function, the natural place to put it would be in Zend/Loader.php.

Added Zend_Loader::autoload() prior to 0.9.1; added Zend_Loader::registerAutoload() in r4259.