Hello,

I'm integrating a custom entity with the entity translations system where I'm using a custom access callback for the edit page. This custom access callback has no arguments.

In entity_translation_menu_alter() lines 454, 456, 467, 469, 485 and 489, the code assumes that page arguments and access arguments are arrays, however, that's not always true.

In case one of those arguments are not defined in the original menu item, those values are not defined, and the call to array_merge() fails and page arguments and access arguments in the new menu item are NULL, so the data is corrupted.

So data is corrupted in entity_translation_edit_access() and entity_translation_edit_page() because func_get_args() is an empty array.
Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plopesc’s picture

Status: Active » Needs review
FileSize
949 bytes

Attaching patch that ensures those values are always an array.

Regards

plopesc’s picture

Issue summary: View changes
pedrosp’s picture

I had the same messages each time I used drush:

array_merge(): Argument #2 is not an array entity_translation.module:470                                                                                                   [warning]
array_merge(): Argument #2 is not an array entity_translation.module:472                                                                                                   [warning]
array_merge(): Argument #2 is not an array entity_translation.module:483                                                                                                   [warning]
array_merge(): Argument #2 is not an array entity_translation.module:485                                                                                                   [warning]
array_merge(): Argument #2 is not an array entity_translation.module:501                                                                                                   [warning]
array_merge(): Argument #2 is not an array entity_translation.module:504 

Your patch make them away for good, it should be considered for release IMHO.

stefanos.petrakis@gmail.com’s picture

Thanks to all people involved for helping out with this so far.

The patch in #1 does solve the problem. However, we should use the + array operator to be more compact and readable, I attach a patch that implements this.

@pedrosp: If you would be so kind to test against this latest patch, we can RTBC this.

stefanos.petrakis@gmail.com’s picture

Status: Needs review » Reviewed & tested by the community

Haven't heard back about this, I am going to RTBC this and commit soon.

  • stefanos.petrakis committed 541b666 on 7.x-1.x
    Issue #2536292 by plopesc, stefanos.petrakis: "Warning: array_merge():...
stefanos.petrakis@gmail.com’s picture

Status: Reviewed & tested by the community » Fixed

Commited and closed. Thanks to everyone that helped!

Status: Fixed » Closed (fixed)

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