Support from Acquia helps fund testing for Drupal Acquia logo

Comments

salvis’s picture

Got one in DNA, too.

pcambra’s picture

Status: Active » Needs review
FileSize
1.6 KB

Let's ask testbot

salvis’s picture

DNA 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?

pcambra’s picture

Status: Needs review » Needs work

Sorry, 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?

salvis’s picture

Sorry, but not sure if I understand the relationship of having the blocks as plugins and the DNA problems.

DNA lives mostly in blocks. I'm working on it.

Do you mean that we might not need even array_merge_recursive there?

I'm not sure. They're not equivalent, and fixing something that is not broken is not necessarily beneficial...

willzyx’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)
grep -R -i array_merge_recursive devel/|wc -l
0

Close this issue since occurences of array_merge_recursive have all been removed