Issue Type: Bug Created: 2009-08-12T01:25:33.000+0000 Last Updated: 2009-08-15T14:02:28.000+0000 Status: Closed Fix version(s): Reporter: Corentin Larose (email@example.com) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Application
Related issues: Attachments:
Zend/Application/Bootstrap/Bootstrap.php doesn't include Zend/Application/Bootstrap/BootstrapAbstract.php while Zend_Application_Bootstrap_Bootstrap extends Zend_Application_Bootstrap_BootstrapAbstract
Posted by Satoru Yoshida (satoruyoshida) on 2009-08-12T06:13:26.000+0000
include/require must be needed? or can be autoloded?
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-08-12T06:18:04.000+0000
I guess most Zend/App* files dont have require_once's because Zend_App is dependent on autoloading:
"It also takes care of setting up the PHP environment and introduces autoloading by default." http://framework.zend.com/manual/en/…
Posted by Satoru Yoshida (satoruyoshida) on 2009-08-12T07:35:11.000+0000
Zend_Application_Bootstrap_BootstrapAbstract can be autoloded, so include/require method is not needed.
Posted by Corentin Larose (firstname.lastname@example.org) on 2009-08-12T07:39:27.000+0000
Zend_App is dependent on autoloading.
You are perfectly right, nevertheless, lazy loading still has an effective cost and should remain the end user's choice.
As far as I'm concerned, I use to load "libraries relations" (for instance: extended class when defining the extension class) using require_once and to use lazy loading when using these classes/libraries.
Posted by Matthew Weier O'Phinney (matthew) on 2009-08-15T14:02:26.000+0000
Autoloading is generally cheaper than calling require_once explicitly, particularly when it comes to library code such as ZF; this is the reason why we recommend stripping require_once calls and enabling autoloading within our performance guide. Leaving require_once statements in leads to issues where multiple files call require_once on the same class file(s) -- leading to a performance decrease due to multiple stat calls being made. (If you don't believe me, do some profiling and benchmarking sometime -- it's eye-opening.)
While I understand your reasons, the fact of the matter was that Zend_Application was designed from the ground up to use autoloading -- the constructor of Zend_Application instantiates autoloading. As such, we chose not to place require_once statements in the various Zend_Application sub-components.
Have you found an issue?
See the Overview section for more details.