ZF-10053: Replace all include_once and require_once by class_exists(%classname%, false) || include %file%

Issue Type: Improvement Created: 2010-06-25T03:02:45.000+0000 Last Updated: 2010-06-25T04:30:23.000+0000 Status: Resolved Fix version(s): Reporter: Bas de Mes (basdemes) Assignee: Matthew Weier O'Phinney (matthew) Tags: Related issues: Attachments:


There is a lot of including in zend framework. To speedup the framework you should use the line:

class_exists(%classname%, false) || include %file%

is faster than include_once after the first time you try to include_once a file

same for require_once of course


Posted by Matthew Weier O'Phinney (matthew) on 2010-06-25T04:30:10.000+0000

This is a micro-optimization at best, and can lead to a number of issues when dependencies are loaded in different ways.

For ZF2, we will be using autoloading only. However, this is a significant BC break, which is why we will not change until that point.

If you wish to speed up the framework, you can make it autoload-friendly now using the unix commands "find" and "sed"; we detail how to do this in the performance appendix of the manual (…).

Have you found an issue?

See the Overview section for more details.


© 2006-2019 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.