If two hooks return arrays whose values are also arrays, the value arrays of the second array overwrite the value arrays of the first array instead of being merged together. The fix is to merge the arrays recursively.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RobRoy’s picture

Version: 5.x-dev » 6.x-dev

This will need to go into HEAD first and then be backported me thinks.

Darren Oh’s picture

FileSize
675 bytes

So here's a patch for HEAD.

Darren Oh’s picture

A bit of research reveals that array_merge_recursive() was not working at the time module.inc was written, which would explain why it was not used. This function was not working properly until PHP 4.3.3.

drewish’s picture

do you have some sample code i could use to test this out?

Darren Oh’s picture

FileSize
1.17 KB

Here's a couple of demo modules to try.

StevenPatz’s picture

Status: Needs review » Postponed (maintainer needs more info)

Is this still an issue?

Darren Oh’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
700 bytes

Definitely. Here's an updated patch.

RobLoach’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies cleanly to HEAD and will allow us to pass arrays of arrays through module_invoke_all.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Gábor Hojtsy’s picture

Note that we now require at least PHP 4.3.3, so we can use the proper function without those bugs noted earlier in PHP.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.