I seem to be having an issue where loading my Zend_Application object with a Zend_Config object produces different results than loading the Zend_Application object with a filename instead. To illustrate my point, I have the two following methods of loading, the first of which works (Mind you all the constants are defined at this point as well:
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
This one doesn't work and gives me the error:
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'No default controller directory registered with front controller' in /var/www/RoommateExpenseBuddy/allan/library/Zend/Application/Bootstrap/Bootstrap.php:91
Stack trace: #0 /var/www/RoommateExpenseBuddy/allan/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#1 /var/www/RoommateExpenseBuddy/allan/public/index.php(36): Zend_Application->run()
#2 {main} thrown in /var/www/RoommateExpenseBuddy/allan/library/Zend/Application/Bootstrap/Bootstrap.php on line 91
/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Config.php';
require_once 'Zend/Config/Ini.php';
require_once 'Zend/Debug.php';
$appConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini', APPLICATION_ENV);
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
$appConfig
);
$application->bootstrap()
->run();
They both are using the same file which looks like this:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
emailNotice.email = "[email protected]"
emailNotice.name = "Roommate Expense Buddy"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.frontController.defaultmodule = "global"
resources.frontController.params.prefixDefaultModule = true
resources.db.adapter = "PDO_MYSQL"
resources.db.isdefaulttableadapter = true
resources.db.params.dbname = "db_name"
resources.db.params.username = "db_user"
resources.db.params.password = "mypassword"
resources.db.params.hostname = "localhost"
resources.db.params.charset = "UTF8"
invitation.defaultViewPath = APPLICATION_PATH "/modules/global/views/scripts/invitation"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
My Directory structure looks something like this with the important folders expanded.
|~application/
| |~configs/
| | |-application.ini
| | `-navigation.xml
| |+helpers/
| |+layouts/
| |+migrations/
| |~modules/
| | `~global/
| | |+controllers/
| | |+forms/
| | |+models/
| | `+views/
| `-Bootstrap.php
|+bin/
|+data/
|+docs/
|+library/
|+public/
`+tests/
So to reiterate, Loading an INI file using the filename in the constructor of Zend_Application produces expected results (working app). Passing a Config object inot the constructor of Zend_Application gives me the above error.
Any clue as to why this would make a difference?
In my case there was a mismatch with casing. The original default directory was declared without camel casing, while a front controller directory I needed to add was indeed cased.
So this is what I had:
To summarize, ZF isn't taking into account casing when doing the initial lookup for the application resource. Subsequent lookups of the already instantiated resource have to match the case of the first declaration, however.
Zend_Application_Bootstrap_BootstrapAbstract::_resolvePluginResourceName