-- till <klimp...@gmail.com> wrote (on Friday, 27 February 2009, 01:19 AM +0100): > On Thu, Feb 26, 2009 at 10:48 PM, Matthew Weier O'Phinney > <matt...@zend.com> wrote: > > -- till <klimp...@gmail.com> wrote > > (on Thursday, 26 February 2009, 09:52 PM +0100): > > > On Thu, Feb 26, 2009 at 9:19 PM, awkaiser > > > <august.kai...@beehivemedia.com> wrote: > > > > > > > > This message is intended for @weierophinney, but feel free to pitch in > > > > if you > > > > have a solution. :) This might be an easy one for you guys! > > > > > > > > The short story is that I'm giving Zend_Loader_Autoloader_Resource > > > > (incubator) a spin and have run into some unexpected behavior. It seems > > > > to > > > > load my classes correctly (my page will display with the expected > > > > information from the database) but Zend_Loader complains with some > > > > warnings: > > > > > > > > Warning: Zend_Loader::include_once(Projects/Model/Projects.php) > > > > [function.Zend-Loader-include-once]: failed to open stream: No such > > > > file or > > > > directory in /[...]/library/Zend/Loader.php on line 83 > > > > > > > > Warning: Zend_Loader::include_once() [function.include]: Failed > > > > opening > > > > 'Projects/Model/Projects.php' for inclusion (include_path='[...]') in > > > > /[...]/library/Zend/Loader.php on line 83 > > > > > > > > Warning: Zend_Loader::include_once(Projects/DbTable/Projects.php) > > > > [function.Zend-Loader-include-once]: failed to open stream: No such > > > > file or > > > > directory in /[...]/library/Zend/Loader.php on line 83 > > > > > > > > Warning: Zend_Loader::include_once() [function.include]: Failed > > > > opening > > > > 'Projects/DbTable/Projects.php' for inclusion (include_path='[...]') in > > > > /[...]/library/Zend/Loader.php on line 83 > > > > > > Somewhat related and more a question for Matthew, but is the > > > *autoloader* supposed to use include_once? > > > > It's using include -- as it should be (look at line 83 of Zend_Loader, > > as reported above, if you don't believe me; it reads "include $file;"). > > > > I'm not sure why it's being reported as "include_once". > > > > We use include() because the _once variant has more of a performance > > impact. Internally, we check first to see if the class_exists(), and > > only if it doesn't do we attempt to include() it. And yes, I've profiled > > and benchmarked both approaches. :) > > Certainly. include_once is slower than include. That's why I was > surprised the code still showed this, maybe it's an earlier version or > whaterver. > > Btw, class_exists() shouldn't be necessary either since __autoload() > is only invoked when a class is not found. So double-checking inside > the autoload seems redundant.
Except that loadClass() can be used outside the autoloader, as well as within it. Until we go with complete autoloading, that has to stay. -- Matthew Weier O'Phinney Software Architect | matt...@zend.com Zend Framework | http://framework.zend.com/