Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Apr 2012 at 09:57 UTC
Updated:
29 Jul 2014 at 20:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
attiks commentedComment #2
nod_Looks rtbc to me. Since it's the base system I'm not rtbc it without another review :)
Comment #3
tim.plunkettWhen and why would this be called on something that isn't an array?
I would think this is won't fix, or even add type hinting to the function signature to force it to blow up.
Comment #4
attiks commentedI ran into this while making a patch for #1279226: jQuery and Drupal JavaScript libraries and settings are output even when no JS is added to the page and it was blowing up on some tests, that's why I added it. The calling function passes an array, but one of the elements of the array wasn't an array itself, so it failed on the second foreach (
foreach ($array as $key => $value) {).Comment #5
sunre #4: You likely wanted to use drupal_array_merge_deep() (without last _array suffix).
Type-hinting won't help here.
This function is called relatively often on big arrays and is slow enough already (is_array() is slow) and only exists because PHP's native array_merge_recursive() doesn't allow for a flag that would change its merge behavior for nested string keys.