Bug #32984
ArrayMergeRecursiveOverrule does not override arrays with simple types
Status: | Resolved | Start date: | 2012-01-05 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Sebastian Kurfuerst | % Done: | 100% |
|
Category: | Utility | |||
Target version: | TYPO3 Flow Base Distribution - 1.1 | |||
PHP Version: | Complexity: | |||
Has patch: | Yes | Affected Flow version: | FLOW3 1.0.0 |
Description
While working on some improvements for the Configuration subsystem, I stumbled over the following issue in arrayMergeRecursiveOverrule:
If the first element contains an array, and the second element contains a simple type at a certain position, the ORIGINAL array is used. I think that's a bug, preventing to reset arrays in configuration.
The following test demonstrates this:
1'inputArray1' => array(
2 'k1' => 'v1',
3 'k2' => array(
4 'k2.1' => 'v2.1'
5 ),
6),
7'inputArray2' => array(
8 'k2' => 'v2a',
9 'k3' => 'v3'
10),
11// That's what SHOULD happen IMHO
12'expected' => array(
13 'k1' => 'v1',
14 'k2' => 'v2a',
15 'k3' => 'v3'
16)
17// That's what happens currently
18'actual' => array(
19 'k1' => 'v1',
20 'k2' => array(
21 'k2.1' => 'v2.1'
22 ),
23 'k3' => 'v3'
24)
This has drastical implications on configuration handling, as it makes it impossible to override an array with NULL:
// per-package settings.yaml Foo: Bar: Baz: value // global settings.yaml Foo: Bar: NULL // Expected: array('Foo' => array('Bar' => NULL)) // Actual (right now) array('Foo' => array('Bar' => array('Baz' => 'value')))
Associated revisions
[BUGFIX] (Utility): ArrayMergeRecursiveOverrule does not override arrays with simple types
If the first element contains an array, and the second element contains a simple
type at a certain position, the ORIGINAL array is used. That bug prevents to reset
array in configuration for example.
A full example is given in issue #32984.
I also added first unit tests for the ArrayMergeRecursiveOverrule function.
Fixes: #32984
Releases: 1.0, 1.1
Change-Id: I676efcb8c6de9e376f7dd7ea364b3c3a99b1625a
[BUGFIX] ArrayMergeRecursiveOverrule does not override arrays with simple types
If the first element contains an array, and the second element contains a simple
type at a certain position, the ORIGINAL array is used. That bug prevents to reset
array in configuration for example.
A full example is given in issue #32984.
I also added first unit tests for the ArrayMergeRecursiveOverrule function.
Change-Id: I98f92ea792d64b568a4695395920093167e72aa1
Fixes: #32984
Releases: 1.0, 1.1
History
#1 Updated by Sebastian Kurfuerst over 3 years ago
- Target version set to 1.1
- Has patch changed from No to Yes
#2 Updated by Sebastian Kurfuerst over 3 years ago
- Subject changed from ArrayMergeRecursiveOverrule does not override arrays with string values to ArrayMergeRecursiveOverrule does not override arrays with simple types
#3 Updated by Gerrit Code Review over 3 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7676
#4 Updated by Gerrit Code Review over 3 years ago
Patch set 1 for branch FLOW3-1.0 has been pushed to the review server.
It is available at http://review.typo3.org/7716
#5 Updated by Sebastian Kurfuerst over 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset b7e76ffd7eed0fb6648d07ec0d5cf109f3ff8568.