Problem/Motivation

Several contstructors in core use \GuzzleHttp\Client as a signature type, making it impossible to use other client implementations. Unless you extend from the original, but that beats the point of interfaces. So this should be replaced with \GuzzleHttp\ClientInterface.

This is the case for:
- Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher
- Drupal\migrate\Plugin\migrate\process\Download

Steps to reproduce

Implement your own httpclient and replace the original. Several errors now occur.

Proposed resolution

Replace the contstructor signatures from \GuzzleHttp\Client to \GuzzleHttp\ClientInterface.

CommentFileSizeAuthor
#3 3221171-3.patch1.26 KBhmendes

Comments

kriboogh created an issue. See original summary.

longwave’s picture

hmendes’s picture

Status: Active » Needs review
StatusFileSize
new1.26 KB

Adding a patch to fix the Drupal\migrate\Plugin\migrate\process\Download case.

longwave’s picture

Component: system.module » migration system
Status: Needs review » Reviewed & tested by the community

Patch is straightforward, changing component as this affects migrate only now.

alexpott credited pookmish.

alexpott’s picture

I've merged #3221171: Use ClientInterface in SecurityAdvisoriesFetcher constructor on commit as this is the same issue and doing in separate issues is not necessary. Crediting @pookmish.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed cfafb87 and pushed to 9.3.x. Thanks!

  • alexpott committed cfafb87 on 9.3.x
    Issue #3222168 by hmendes, kriboogh, longwave, pookmish: Replace \...
bbrala’s picture

Hmm, when #3039047: Adopt php-http/guzzle6-adapter 2.x to get PSR-18 support without losing Guzzle's async support lands, shouldn't this become the generic psr ClientInterface instead of the guzzle specific one? Or do we need guzzle specific features?

alexpott’s picture

@bbrala yes when that lands we'll need to update things = but atm we're not there yet to so this is making things better, step-by-step.

Status: Fixed » Closed (fixed)

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