2.2.6+ has an undeclared dependency on newer versions of GuzzleHTTP, breaking D9

Created on 22 August 2025, 11 days ago

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

πŸ› Bug report
Status

Active

Version

2.0

Component

General

Created by

πŸ‡ΊπŸ‡ΈUnited States seanr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @seanr
  • πŸ‡ΊπŸ‡ΈUnited States seanr

    OK, this should do it.

  • πŸ‡ΊπŸ‡ΈUnited States seanr

    "Just the patch, ma'am." πŸ˜‚

  • @seanr opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States seanr
  • πŸ‡ΊπŸ‡ΈUnited States seanr

    These 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?

    1) Drupal\Tests\mailchimp_lists\Functional\MailchimpListsTest::testGetList
    Attempt to read property "id" on bool
    /builds/issue/mailchimp-3542646/modules/mailchimp_lists/tests/src/Functional/MailchimpListsTest.php:27
    /builds/issue/mailchimp-3542646/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    2) Drupal\Tests\mailchimp_signup\Functional\MailchimpSignupFormTest::testSignUpForm
    Behat\Mink\Exception\ElementNotFoundException: Form field with id|name|label|value "mc_lists[57afe96172]" not found.
    /builds/issue/mailchimp-3542646/vendor/behat/mink/src/WebAssert.php:731
    /builds/issue/mailchimp-3542646/web/core/tests/Drupal/Tests/UiHelperTrait.php:90
    /builds/issue/mailchimp-3542646/modules/mailchimp_signup/tests/src/Functional/MailchimpSignupFormTest.php:65
    /builds/issue/mailchimp-3542646/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    3) Drupal\Tests\mailchimp_signup\Functional\MailchimpSignupFormTest::testEditSignUpForm
    Behat\Mink\Exception\ResponseTextException: The text "Signup Forms" was not found anywhere in the text of the current page.
    /builds/issue/mailchimp-3542646/vendor/behat/mink/src/WebAssert.php:907
    /builds/issue/mailchimp-3542646/vendor/behat/mink/src/WebAssert.php:293
    /builds/issue/mailchimp-3542646/web/core/tests/Drupal/Tests/WebAssert.php:979
    /builds/issue/mailchimp-3542646/modules/mailchimp_signup/tests/src/Functional/MailchimpSignupFormTest.php:135
    /builds/issue/mailchimp-3542646/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    4) Drupal\Tests\mailchimp_signup\Functional\MailchimpSignupFormTest::testSubscribeWithMinimalConfiguredSignUpForm
    Behat\Mink\Exception\ElementNotFoundException: Button with id|name|label|value "Sign up" not found.
    /builds/issue/mailchimp-3542646/web/core/tests/Drupal/Tests/WebAssert.php:158
    /builds/issue/mailchimp-3542646/web/core/tests/Drupal/Tests/UiHelperTrait.php:83
    /builds/issue/mailchimp-3542646/modules/mailchimp_signup/tests/src/Functional/MailchimpSignupFormTest.php:178
    /builds/issue/mailchimp-3542646/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    
  • πŸ‡ΊπŸ‡ΈUnited States xenophyle

    Ah, good catch. Will your fix work without the

    use function GuzzleHttp\default_user_agent;
    

    line?

    The failing tests are not likely to be your fault -- they need a lot of work.

Production build 0.71.5 2024