Zend Framework

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

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Application
  • Labels:
    None

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:

$options = $this->mergeOptions($options, $this->_loadConfig($options['config']));

to:

$options = $this->mergeOptions($this->_loadConfig($options['config']), $options);

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

Using the following code:

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'
)
)
));

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.

Activity

Hide
Simon Corless added a comment -

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

Show
Simon Corless added a comment - This appears to have been done in 1.8.2 sorry for not finding the original bug report.
Hide
Simon Corless added a comment -

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?

Show
Simon Corless added a comment - 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?
Hide
Jason Brumwell added a comment -

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

Show
Jason Brumwell added a comment - 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
Hide
Simon Corless added a comment -

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.

Show
Simon Corless added a comment - 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.
Hide
Jon Whitcraft added a comment -

This has been checked into the trunk.

Show
Jon Whitcraft added a comment - This has been checked into the trunk.
Hide
Jon Whitcraft added a comment -

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.

Show
Jon Whitcraft added a comment - 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.
Hide
Andy Fowler added a comment -

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/227-Exposing-Service-APIs-via-Zend-Framework.html

(Overriding a .ini config with array data).

Show
Andy Fowler added a comment - 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/227-Exposing-Service-APIs-via-Zend-Framework.html (Overriding a .ini config with array data).
Hide
Simon Corless added a comment -

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.

Show
Simon Corless added a comment - 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.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: