privatemsg/privatemsg_attachments/privatemsg_attachments.module on line 84.

      $form['attachments']['wrapper'] += _privatemsg_attachments_form($files);
      // Execute submit function as validate, to have it executed before
      // $form_state['validate_built_message'] is created.
      array_unshift($form['submit']['#validate'], '_privatemsg_attachments_upload_submit');
      if (isset($form['preview'])) {
        array_unshift($form['preview']['#validate'], '_privatemsg_attachments_upload_submit');
      }

Should be a check like

if(is_array($form['submit']['#validate']){
  array_unshift($form['submit']['#validate'], '_privatemsg_attachments_upload_submit');
}else{
  $form['submit']['#validate'][] = 'privatemsg_attachments_upload_submit';
}

Comments

berdir’s picture

Status: Active » Postponed (maintainer needs more info)

Have you made any customizations to the form?

Are you sure that you are using the most recent version of 6.x-2.x?

Because we can't simply add a check there. The #validate key must exist or it won't work.

We have tests that run this form and no warning is thrown, so it exists by default.

berdir’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing this issue as there has been no response in multiple weeks.

twiik’s picture

Status: Closed (cannot reproduce) » Active

Opened it again as I just installed the latest dev version and got the same error.

warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/*/sites/all/modules/privatemsg/privatemsg_attachments/privatemsg_attachments.module on line 83.

It appeared when the recipient was blocked because his mailbox is full. If he deletes a message the error goes away, but if he's full again it reappears.

Also, when I'm blocked from sending the attachment form is still visible even though the reply form is not.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new1.05 KB

Confirmed, the fix is trivial, I actually thought of this case but forgot to add the return statement.

berdir’s picture

Version: » 6.x-2.x-dev
Status: Needs review » Fixed

Commited the patch.

berdir’s picture

Forgot to actually push the change, if anyone was wondering if this isn't part of the -dev release yet. Should be soon now!

Status: Fixed » Closed (fixed)

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