Situation

  1. You have no comments on the site.
  2. You visit admin/content/comment and hit Update to create any action, though the list is empty.

Following those steps, gets you the following error:

    *  Warning: array_diff(): Argument #1 is not an array in comment_admin_overview_validate() (line 113 of /home/manuel/htdocs/d7/modules/comment/comment.admin.inc).
    * Please select one or more comments to perform the update on.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mr.baileys’s picture

Title: comment_admin_overview_validate breaks if no comments » Comment bulk update: warning if no comments selected.
FileSize
934 bytes

Patch attached that verifies that $form_state['values']['comments'] is an array before performing array operations on it.

Also, the validation handler starts with:

$form_state['values']['comments'] = array_diff($form_state['values']['comments'], array(0));

Looking at comment_admin_overview, I don't see how $form_state['values']['comments'] can contain the value "0", so I suspect that this is a remnant from earlier times and have tentatively removed the array_diff portion since I think it is no longer needed...

mr.baileys’s picture

Status: Active » Needs review
aspilicious’s picture

FileSize
207.81 KB

Still an issue and #1 still applies and works

"Looking at comment_admin_overview, I don't see how $form_state['values']['comments'] can contain the value "0", so I suspect that this is a remnant from earlier times and have tentatively removed the array_diff portion since I think it is no longer needed..."

Can someone gives this note a review and mark this rtbc (if the note is correct)

ff1’s picture

#1: comment-bulk-operations.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, comment-bulk-operations.patch, failed testing.

dixon_’s picture

Status: Needs work » Closed (works as designed)

I have tested this on both 7.x and 8.x. The issue seems to have been fixed somewhere else.