Zend Framework

Add autoload() method to Zend_Loader class

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 0.9.2
  • Component/s: Zend_Loader
  • Labels:
    None

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.

Activity

Hide
Bill Karwin added a comment -

Assign to Matthew.

Show
Bill Karwin added a comment - Assign to Matthew.
Hide
Matthew Ratzloff added a comment -

See [http://framework.zend.com/wiki/display/ZFPROP/What+to+do+with+Zend.php?focusedCommentId=21061#comment-21061]

Nico's idea is:

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

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

Show
Matthew Ratzloff added a comment - See [http://framework.zend.com/wiki/display/ZFPROP/What+to+do+with+Zend.php?focusedCommentId=21061#comment-21061] Nico's idea is:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
?>
I like this. Alternately, it could just be Zend_Loader::autoload().
Hide
Bill Karwin added a comment -

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.

Show
Bill Karwin added a comment - 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.
Hide
Matthew Weier O'Phinney added a comment -

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

Show
Matthew Weier O'Phinney added a comment - Added Zend_Loader::autoload() prior to 0.9.1; added Zend_Loader::registerAutoload() in r4259.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: