-- Bart McLeod <[email protected]> wrote (on Monday, 27 April 2009, 05:09 PM +0200): > Notice: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will > be removed with 2.0.0; use Zend_Loader_Autoloader instead in E:\ZendFramework\ > library\Zend\Loader.php on line 186 > > What about Backwards Compatibility? This doesn't look good for sure. Makes me > think I should wrap the framework...
Zend_Loader's autoload solution has been basically broken from the outset, and there's no way to fix it cleanly within that class. Zend_Loader_Autoloader provides a much better solution that covers all the use cases thrown at it so far: ability to toggle suppression of errors, ability to register namespaces and do opportunistic mapping of namespaces to autoloaders, ability to add instance methods as callbacks to an autoloader -- and then remove and/or re-add them if desired (something spl_autoload does not support cleanly), etc. Note that we're marking Zend_Loader::autoload as _deprecated_ -- it's not being removed, but we're giving fair warning that you may want to update your code. This is a practice we've been using for some time to mark deprecated code. > Matthew Weier O'Phinney schreef: > > -- holografix . <[email protected]> wrote > (on Monday, 27 April 2009, 02:34 PM +0100): > > > I have an application developed with ZF 1.7 and it works fine up to > ZF 1.7.8. > After update developpment box to ZF to latest trunk version, > starting to get notices about Zend_Loader::registerAutoload(), saying > it's > deprecated and will be removed in 2.0.0. > This application follows ZF directory structure and it registers a > front > controller plugin where resources are initialized. > > New code in bootstrap.php: > > require_once 'Zend/Loader/Autoloader.php'; > > $loader = > Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true); > $loader->registerNamespace('ZendExt_'); > > $front = Zend_Controller_Front::getInstance(); > $front->registerPlugin(new > ZendExt_Plugin_Initialize(APPLICATION_ENV)); > > Resources are initialized but have some problems with loading a form. > > When opening the application, if one is not logged in, it redirects > to index/ > login (Form_Login.php) > http://application => http://application/login > > Forms are in a dir called forms under application dir. > In login action I have this code > > public function loginAction() > { > include APPLICATION_PATH . "/forms/Form_Login.php"; > > $loginForm = new Form_Login(); > > ... validation and authentication > } > > The output is wrong > > <form action="/login" method="post" id="formlogin" name="formlogin"> > <fieldset> > <legend>Login</legend> > <form id="username"></form> > <form id="password"></form> > <form id="submit"></form> > </fieldset> > </form> > > > With Zend_Loader there are no problems. > How can I fix the problem ? > > > Use a module autoloader: > > $module = new Zend_Application_Module_Autoloader(array( > 'namespace' => '', > 'basePath' => APPLICATION_PATH . '/forms', > )); > > Then make sure your form is in the file: > > APPLICATION_PATH/ > forms/ > Login.php > > and contains the clas 'Form_Login'. > > You can do that anywhere -- your bootstrapping code is probably the best > place, however. Once you have, you will not need to do an > include/include_once to get your form -- just 'new Form_Login()'. > > > -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/
