Bug or a feature: drupalSettings array is not merging anymore?

2017-09-21 13:16:05

I have just noticed that when I use

$form['#attached']['drupalSettings']['foo']['bar'][] = microtime();

// or...the depth does not matter

$form['#attached']['drupalSettings']['foo'][] = microtime();

multiple times with different values I end up only with one value being present in DOM. So for some reason Drupal 8 no longer renders the array properly. When I use specific keys, all values are present in DOM.

Is this a bug or a feature? I haven't noticed this behavior in the past 3 years so far so I am not sure if this is API change or not. I am specifically not using keys since I want the result to be array, not object.

I would assume this is an issue with NestedArray:mergeDeep() ?