Issue Type: Bug Created: 2009-10-01T09:10:04.000+0000 Last Updated: 2012-11-20T21:37:59.000+0000 Status: Open Fix version(s): Reporter: William Vicary (willsemto) Assignee: None Tags: - Zend_Application
Related issues: Attachments: - ZendTest.rar
When using "Fallback Autloader" with Zend_Test_PHPUnit_ControllerTestCase and Zend_Application, upon the second test setUp() the application is redeclaring Zend_Db even though Zend_Db was never explicitly declared anywhere in the project.
Posted by William Vicary (willsemto) on 2009-10-01T09:14:50.000+0000
Here is the source code to reproduce the issue. It works fine when you do not use the fallback autoloader, for example, if I go to tests/application/Bootstrap.php and replacing the fallback autoloader line with the following code:
$autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('TestCase');
Posted by Ramon Henrique Ornelas (ramon) on 2010-02-24T19:14:05.000+0000
try using, for silence of the error redeclare
<pre class="highlight"> Zend_Loader_Autoloader::suppressNotFoundWarnings(true);
Zend_Application::bootstrap(), execute all resources, if not passing the resource wanted. In your case, beyond execute the resource FrontController execute the resource of the Db.
Posted by William Vicary (willsemto) on 2010-03-08T06:32:48.000+0000
The issue is not that warnings are being raised, the problem lies that Zend attempts to autoload blindly on line 354 of Zend_Bootstrap_BootstrapAbstract, the use of class_exists($plugin) where $plugin is "db", "view" (or whatever you have in your application.ini resource.*) this causes class_exists to call the autoloader with "db" which when not using useFallbackAutoloader(true) causes it to blindly check include paths for the file "Db.php" which it finds in my ZF include path but as the class does not exist within the file it will attempt to autoload it again upon the second testcase and crash with a fatal error that class Zend_Db is already initiated.
This error also affects live code, but produces warnings that are surpressed, if you try loading a zend website using the bootstrap within a debugger such as Zend or XDebug the error messages should be shown in the console.
Have you found an issue?
See the Overview section for more details.