Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Change notice: http://drupal.org/node/1887290
It's better to wait until #1880818: Blocks are now plugins, adapt devel ones to D8 gets in.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1892160-replace_array_merge_recursive-2.patch | 1.6 KB | pcambra |
Comments
Comment #1
salvisGot one in DNA, too.
Comment #2
pcambraLet's ask testbot
Comment #3
salvisDNA is dysfunctional right now: #1916968: Change DNA's blocks to plugins and fix comments and variable naming. This means we can't test the result.
NestedArray::mergeDeep() is not really a replacement for array_merge_recursive() — it performs a different operation.
It's strange that Use \Drupal\Component\Utility\NestedArray::mergeDeep() instead of array_merge_recursive() seems to position NestedArray::mergeDeep() as a drop-in replacement. The idea of having to document why you're using one function and not the other may serve educational purposes in core, but I don't think it can be generalized to contrib.
The OP himself indicates in #1356170-1: Remove all uses of array_merge_recursive, or document why they are being used instead of NestedArray::mergeDeep() that it's appropriate to "sit down to think about whether the replacement is appropriate."
I'll look into the usage in DNA when DNA is back in service. Let's leave that as it is for now.
@pcambra: Have you analyzed the implications in DevelExecutePHP.php? Do we really want NestedArray::mergeDeep(), which would mean we have a bug in the current code in all version?
Comment #4
pcambraSorry, but not sure if I understand the relationship of having the blocks as plugins and the DNA problems.
Honestly I just made the replacements as the notice said they were equivalent, reading more deeply on the issues you paste, they're not equivalent for all cases.
For executing php, it works just fine.
Do we really want NestedArray::mergeDeep(), which would mean we have a bug in the current code in all version?
Do you mean that we might not need even array_merge_recursive there?
Comment #5
salvisDNA lives mostly in blocks. I'm working on it.
I'm not sure. They're not equivalent, and fixing something that is not broken is not necessarily beneficial...
Comment #6
willzyx CreditAttribution: willzyx commentedClose this issue since occurences of
array_merge_recursive
have all been removed