Problem/Motivation
Unfortunately, we've still got some clients on Drupal 9. The latest two releases for mailchimp 2.x in late July introduced an undeclared dependency on a newer version of GuzzleHTTP that wasn't backward compatible, resulting in the following error when we did our monthly updates:
The website encountered an unexpected error. Please try again later.
Error: Call to undefined method GuzzleHttp\Utils::defaultUserAgent() in _mailchimp_get_user_agent() (line 79 of modules/contrib/mailchimp/mailchimp.module).
Steps to reproduce
Upgrade any D9 site to mailchimp 2.2.6 or newer.
Proposed resolution
The workaround was to revert to 2.2.5. mailchimp.module contains the following code at line 79:
$user_agent = "DrupalMailchimp/$version " . Utils::defaultUserAgent();
Prior to that, it was this:
$user_agent = "DrupalMailchimp/$version " . default_user_agent();
We need some kind of wrapper on that to determine whether the new method exists before attempting to use it, falling back to the old one if it does not (or vice versa).
Remaining tasks
Write a patch (I'm on it). 🤣
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3542646-9--guzzle.patch | 673 bytes | anpel |
| #5 | 3542646-3--guzzle.patch | 696 bytes | seanr |
Issue fork mailchimp-3542646
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
seanrOK, this should do it.
Comment #3
seanr"Just the patch, ma'am." 😂
Comment #5
seanrComment #6
seanrThese errors don't read like anything of mine (I barely touched anything 🤣) - gonna need some input on this, but I wonder if these were failing already?
Comment #7
xenophyle commentedAh, good catch. Will your fix work without the
line?
The failing tests are not likely to be your fault -- they need a lot of work.
Comment #8
anpel commentedI have this error on 9.3.11 using 2.2.7.
The error remains after applying the patch on#5.
Comment #9
anpel commentedHere is a patch from #3 that also includes
Comment #11
xenophyle commented