Issues

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

Issue Type: Improvement Created: 2009-05-26T14:28:45.000+0000 Last Updated: 2009-11-13T00:03:40.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Simon Corless (sico) Assignee: Jon Whitcraft (sidhighwind) Tags: - Zend_Application

Related issues: Attachments: - Zend Application - Config Merge.patch

Description

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.

Comments

Posted by Simon Corless (sico) on 2009-05-29T05:02:11.000+0000

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

Posted by Simon Corless (sico) on 2009-06-03T02:25:38.000+0000

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?

Posted by Jason Brumwell (baxter) on 2009-09-09T09:41:16.000+0000

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

Posted by Simon Corless (sico) on 2009-09-09T10:00:59.000+0000

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.

Posted by Jon Whitcraft (sidhighwind) on 2009-11-09T08:15:36.000+0000

This has been checked into the trunk.

Posted by Jon Whitcraft (sidhighwind) on 2009-11-09T08:45:17.000+0000

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.

Posted by Andy Fowler (andyfowler) on 2009-11-12T15:46:17.000+0000

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: http://weierophinney.net/matthew/archives/…

(Overriding a .ini config with array data).

Posted by Simon Corless (sico) on 2009-11-13T00:03:38.000+0000

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.

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