Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

array property overriding not merging in Application.ini #64

Closed
zfbot opened this Issue Apr 5, 2013 · 5 comments

Comments

Projects
None yet
3 participants

zfbot commented Apr 5, 2013

Jira Information

Original Issue:ZF-12539
Issue Type:Bug
Reporter:Omar Shaban
Created:03/13/13
Assignee:
Components:Zend_Config

Description

In config Ini, When inheriting environment from another, and appending to an existing array, it overrides its values instead of merging it

example
[production]
props[]="A"
[development : production]
props[]="B"

using development environment
output:
array{
[0]=>"B"
}

Expected:
array{
[0]=>"A"
[1]=>"B"
}

In case I need to reset the array I can reset it using
props[]=

zfbot commented Apr 5, 2013

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF-12539

Known GitHub users mentioned in the original message or comment:

zetta commented Sep 2, 2014

Guys, do you have any information about this issue?

Member

froschdesign commented Jan 6, 2015

Zend_Config_Ini doesn't support merging arrays from different sections. Overwriting is the only option.

@froschdesign froschdesign added wontfix and removed bug labels Jan 6, 2015

zetta commented Jan 8, 2015

@froschdesign that's not true. sometimes they merge and sometimes they overwrite (actually the method name is merge).

  • If array A has 3 childs and array B has 1 then only the content of array B will be keept.
  • if array A(a,a,a,a,a) has 5 childs and array B(b,b) has 2 then the result will be (b,b,a,a,a).

Please reopen this issue.

Member

froschdesign commented Jan 9, 2015

@zetta
Sorry, my answer was to short.

Yes, we can add a small piece of code to the Zend_Config_Ini:: _processSection() method to handle a big part of the problem. But I see a BC break: If we change the behaviour of the array handling, then many applications will break.

Please reopen this issue.

Create a PR and we will review it. (Please recheck the implementation in ZF2. Maybe it is better to create a PR for version 2 and we backport the functionality to version 1.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment