Problem/Motivation

When using the workbench_moderation module and clicking the 'unpublish this revision' link, a warning appears above the confirmation form.

Warning message:

Warning: Invalid argument supplied for foreach() in media_gallery_menu_local_tasks_alter() (line 177 of /srv/drupal/shortbread/releases/201111230942/sites/all/modules/changed/media_gallery/media_gallery.module).

Steps to reproduce

- Enable workbench_moderation module
- Create a gallery with moderation state published
- Click the 'unpublish this revision' link
- See the warning appear when the confirmation form is shown.

Proposed resolution

Make sure that there are local tasks present before looping through them by adding a check for this in media_gallery_menu_local_tasks_alter()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

c31ck’s picture

Created a patch that checks if $tabs is an array before looping through it.

c31ck’s picture

Status: Active » Needs review
Moloc’s picture

I can confirm the warning.

Attaching another patch with less code. It just replaces your added code
&& isset($data['tabs'][0]['output']) && is_array($data['tabs'][0]['output'])
with
&& !empty($data['tabs'])

lsolesen’s picture

Status: Needs review » Fixed

Committed Moloc's patch.

Status: Fixed » Closed (fixed)

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