After upgrading to 7.x-4.0, I'm getting a fatal error when visiting a page with a mailchimp signup block:

PHP Fatal error: Cannot use object of type stdClass as array in .../mailchimp/modules/mailchimp_signup/includes/mailchimp_signup.admin.inc on line 160

Sure enough, you can see in the code that $mergevar is an object, and so it needs the name assigned as an object property and not an array member.

This fixes it:

@@ -157,7 +157,8 @@ function mailchimp_signup_form($form, &$form_state, MailchimpSignup $signup) {
       foreach ($list_mergevars as $mergevar) {
         $form_state['mergevar_options'][$mergevar->tag] = $mergevar;
         if (!$mergevar->public) {
-          $form_state['mergevar_options'][$mergevar->tag]['name'] .= ' (private)';
+          $form_state['mergevar_options'][$mergevar->tag]->name .= ' (private)';
         };
       }
     }

CommentFileSizeAuthor
#2 mailchimp-php-fatal-error-2707763.patch747 bytesfreelock
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

freelock created an issue. See original summary.

freelock’s picture

Patch attached.

freelock’s picture

Title: PHP Fatal error: » PHP Fatal error:Cannot use object of type stdClass as array in Cannot use object of type stdClass as array in mailchimp_signup.admin.inc
Status: Active » Needs review

Updating status and title...

  • ruscoe committed 968801e on 7.x-4.x authored by freelock
    Issue #2707763 by freelock: PHP Fatal error:Cannot use object of type...
ruscoe’s picture

Status: Needs review » Fixed

Great catch, thank you. I've committed this and we'll get a new release out with some other fixes later today.

Status: Fixed » Closed (fixed)

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