ZF-6811: Zend Application - Merge Config Should Overwrite ini With Array Data?


I believe it would be more useful if the config options from an ini file (if specified in the 'config' option) were overwritten by any configuration options supplied as part of the options array in the Zend_Application constructor (i.e. array('resources' => array('option' => 'value'))).

I think the function setOptions(array $options) on line 117 of Zend/Application.php should be altered. Changing it from:

{quote}$options = $this->mergeOptions($options, $this->_loadConfig($options['config']));{quote} to: {quote}$options = $this->mergeOptions($this->_loadConfig($options['config']), $options);{quote}

I believe the case is stronger to overwrite ini data via the constructor call than it would be in reverse.

Using the following code: {quote} application.ini: resources.frontController.defaultModule = "content"

index.php: $application = new Zend_Application(APPLICATION_ENV, array( 'config' => ROOT_PATH . 'application/config/bootstrap/application.ini', 'resources' => array( 'frontController' => array( 'defaultModule' => 'admin' ) ) )); {quote} Causes the defaultModule to be content. I would like the outcome to make the defaultModule admin as specified in the array and not the ini file.


This appears to have been done in 1.8.2 sorry for not finding the original bug report.

I seem to have jumped the gun a little here and the issue hasn't been resolved in 1.8.2. Can you reset this issue to unresolved?

I agree, I am writing a cron portion of a site I'm working on and would like to use the original application config, which has:

bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap"

I would like to update that to my cron bootstrap.php file, through the option settings

This is a patch file to fix the issue, I have never done this before so I don't know the correct way of doing it. It's the patch I use for my local copies of the Framework.

I would really like to see this fixed.

This has been checked into the trunk.

After talking with Matthew about this issue it will not be made available in the 1.9.x cycle as it changes the behavior slightly.

It will be included in the 1.10 release.

I'd vote for this to enter the 1.9.x cycle. I'm slightly confused on Matthew's stance, because he seems to be endorsing the new behavior in the last example on his article:…

(Overriding a .ini config with array data).

I agree, there is a BC break but that BC doesn't work to start with!, considering you can't actually over write anything unless it's not been set in the first place!

Still I'm happy to have it fixed eventually and to stop having to patch my files.