- Issue created by @Rob230
- π¬π§United Kingdom Rob230
Alternatively it should return an empty array instead of NULL.
- π¬π§United Kingdom Rob230
That actually still didn't fix the error, because it turns out it can be FALSE as well. At least that is what is on the entity, I assume it is the same after an entity is saved.
$user->get('field_mailchimp_field')->get(0); => Drupal\mailchimp_lists\Plugin\Field\FieldType\MailchimpListsSubscription {#8216 value: [ "subscribe" => "0", "interest_groups" => false, ], }
Notice "subscribe" is also "0" rather than FALSE, so maybe this is data from an earlier version of the module which is causing it to have errors. I don't know if there should be something done to fix the data, e.g. to make it like this:
[ "subscribe" => false, "interest_groups" => [], ]
But here is a patch to just fix the PHP error.
- πΊπΈUnited States aprice42
@Rob230 I wonder if this patch might resolve the issue? Just adding a check over that entire block of code to see if the new_interest_groups exists and is an array.
- Status changed to Needs review
over 1 year ago 12:21am 27 May 2023 - Open on Drupal.org βCore: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - Status changed to Closed: duplicate
about 1 year ago 8:33pm 19 September 2023