ArrayMergeRecursiveOverrule does not override arrays with simple types
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:
'inputArray1' => array( 'k1' => 'v1', 'k2' => array( 'k2.1' => 'v2.1' ), ), 'inputArray2' => array( 'k2' => 'v2a', 'k3' => 'v3' ), // That's what SHOULD happen IMHO 'expected' => array( 'k1' => 'v1', 'k2' => 'v2a', 'k3' => 'v3' ) // That's what happens currently 'actual' => array( 'k1' => 'v1', 'k2' => array( 'k2.1' => 'v2.1' ), 'k3' => 'v3' )
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')))