Issues

ZF-6707: Zend_Application_Resource_Modules with setFallbackAutoloader turned on causes failure

Issue Type: Bug Created: 2009-05-17T15:27:11.000+0000 Last Updated: 2009-06-24T21:20:21.000+0000 Status: Resolved Fix version(s): Reporter: Chris Jones (leeked) Assignee: Jurrien Stutterheim (norm2782) Tags: - Zend_Application

  • Zend_Loader

Related issues: Attachments:

Description

If you have setFallbackAutoloader turned on:

<pre class="highlight">
$autoloader = Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);

Then the call to class_exists() in Zend_Application_Resource_Modules to load the {Module}_Bootstrap class will fail.

Here is the patch to correct the issue:

<pre class="highlight">
Index: Modules.php
===================================================================
--- Modules.php (revision 15619)
+++ Modules.php (working copy)
@@ -38,8 +38,8 @@
 
     /**
      * Constructor
-     * 
-     * @param  mixed $options 
+     *
+     * @param  mixed $options
      * @return void
      */
     public function __construct($options = null)
@@ -68,7 +68,7 @@
             }
 
             $bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap';
-            if (!class_exists($bootstrapClass)) {
+            if (!class_exists($bootstrapClass, false)) {
                 $bootstrapPath  = $front->getModuleDirectory($module) . '/Bootstrap.php';
                 if (file_exists($bootstrapPath)) {
                     include_once $bootstrapPath;
@@ -90,7 +90,7 @@
 
     /**
      * Get bootstraps that have been run
-     * 
+     *
      * @return ArrayObject
      */
     public function getExecutedBootstraps()
@@ -100,8 +100,8 @@
 
     /**
      * Format a module name to the module class prefix
-     * 
-     * @param  string $name 
+     *
+     * @param  string $name
      * @return string
      */
     protected function _formatModuleName($name)

Comments

Posted by Chris Jones (leeked) on 2009-05-17T15:28:11.000+0000

Updating title to be more descriptive

Posted by Miroslav Kubelik (koubel) on 2009-06-17T05:07:09.000+0000

Yes, this is very annoing and it doesn't have any useful workaround, maybe enable fallback autoloader at the end of module_bootstrap, I'm voting for it please. Patch seems very easy. It's still in 1.8.3.

Posted by Jurrien Stutterheim (norm2782) on 2009-06-24T21:20:19.000+0000

Fixed with solution for ZF-7002

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts