Allow to use Guzzle 7

Created on 20 October 2022, about 2 years ago
Updated 18 September 2024, 4 months ago

Problem/Motivation

In the 3.x version "php-http/guzzle6-adapter" is required, so it does not allow to update to Guzzle 7, but in the composer.json says that allows Guzzle 7.

    "require": {
..
        "guzzlehttp/guzzle": "^6.5 || ^7.2",
        "php-http/guzzle6-adapter": "^2.0 || ^3.0"
    },

I saw that the adapter is used SearchApiSolrAcquiaConnector to set the http_client, but first is instance with the Guzzle and if is not is a ClientInterface, then uses the adapter.

    // Create a PSR-18 adapter instance, since Solarium's HTTP adapter is
    // incompatible with remote_stream_wrapper.
    // See https://www.drupal.org/project/acquia_search/issues/3209704
    // And https://www.drupal.org/project/acquia_search_solr/issues/3171407
    $httpClient = new GuzzleClient();
    if (!($httpClient instanceof ClientInterface)) {
      // BC for Drupal 9 and 8 using Guzzle 6.
      if (class_exists(Guzzle6Client::class)) {
        $httpClient = new Guzzle6Client();
      }
      else {
        \Drupal::logger('acquia_search')->error("Guzzle7 or php-http/guzzle6-adapter is required to use Acquia Search");
        return FALSE;
      }
    }

Proposed resolution

Remove dependency php-http/guzzle6-adapter from the composer, and only add as a suggestion, not as a requirement.

📌 Task
Status

Closed: outdated

Version

3.0

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024