guzzle-description-loader dependency is broken

Created on 5 December 2023, 12 months ago
Updated 2 February 2024, 10 months ago

Problem/Motivation

Something has changed and now guzzle-description-loader which this module depends on is broken and throws this error:

Fatal error:  Declaration of Guzzle\Service\Loader\FileLoader::load($resource, $type = null) must be compatible with Symfony\Component\Config\Loader\LoaderInterface::load(mixed $resource, ?string $type = null): mixed in /opt/drupal/vendor/arthurkirkosa/guzzle-description-loader/src/FileLoader.php on line 19"

If type hints are added to that function then it throws this error:

Fatal error: Declaration of Guzzle\Service\Loader\YamlLoader::supports($resource, $type = null) must be compatible with Symfony\Component\Config\Loader\LoaderInterface::supports(mixed $resource, ?string $type = null): bool in /opt/drupal/vendor/arthurkirkosa/guzzle-description-loader/src/YamlLoader.php on line 39"

It looks like at some point Symfony's LoaderInterface added more explicit type hints which implicates the load and supports methods used in guzzle-description-loader's loaders.

Steps to reproduce

Install this module on a fresh install of Drupal 10.

Proposed resolution

The fix is pretty easy - just need to add those type descriptors to the supports methods in JsonLoader, YamlLoader, PhpLoader and the load method in FileLoader (see attached patch) - but I'm not sure if guzzle-description-loader is still maintained so not sure what the best approach is here.

๐Ÿ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand fraserthompson Dunedin, New Zealand

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

Comments & Activities

  • Issue created by @fraserthompson
  • ๐Ÿ‡ธ๐Ÿ‡ฆSaudi Arabia martins.bruvelis Thuwal

    I can confirm that adding the patch 'guzzle-description-loader-fix.patch' usign composer.json, to arthurkirkosa/guzzle-description-loader module, resolves the issue:

    ,
                "arthurkirkosa/guzzle-description-loader": {
                    "3406108 - guzzle-description-loader dependency is broken": "https://www.drupal.org/files/issues/2023-12-05/guzzle-description-loader-fix.patch"
                }
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States datawench

    Patch also works for me. Thanks for figuring this out so quickly.
    Given that the library is so old, perhaps a module maintainer here might fork it, update it, and use it instead?

  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly aronne

    Hi guys,
    I've just made a fork of that library and here you can find the patch that should fix the problem.

    Regards,
    aronne

    • aronne โ†’ authored b13dd86a on 3.x
      Issue #3406108 by fraserthompson, aronne: guzzle-description-loader...
  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly aronne

    Hmm no I have to figure out why composer canโ€™t find the release

    Iโ€™ll work on it later

  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly aronne

    Ok this patch should be the right one.
    I've already submitted it on the dev version so please let me know if it works for you as well by doing
    composer require 'drupal/http_client_manager:3.x-dev@dev'

    Regards,
    aronne

    • aronne โ†’ authored c39f4279 on 3.x
      Issue #3406108 by aronne: guzzle-description-loader dependency is broken
      
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States datawench

    The #7 patch works great, thank you!

    Sticking with the patch for now, until it gets merged into a release version.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly trickfun

    Instruction #2 works fine.
    Patch #7 doesn't work. file composer.json doesn't change in module folder.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly aronne

    @trickfun composer.json will never change if you run patch #7 in the drupal root instead of the module root.

  • Status changed to RTBC 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly aronne
  • Status changed to Fixed 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly aronne
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States datawench

    @aronne I'm not sure I understand. Are you saying that the patch shouldn't apply if you add the appropriate element in the cweagans-style "patches" portion of the root composer.json?

    "drupal/http_client_manager": {
                    "guzzle-description-loader dependency is broken (see https://www.drupal.org/project/http_client_manager/issues/3406108)": "https://www.drupal.org/files/issues/2023-12-22/3406108-7.patch"
                }
    
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly aronne

    Patch #7 doesn't work. file composer.json doesn't change in module folder.

    No I'm just saying that if you put the patch in the drupal document root, as I think he did, and then you run git apply 3406108-7.patch it won't work.

    @aronne I'm not sure I understand. Are you saying that the patch shouldn't apply if you add the appropriate element in the cweagans-style "patches" portion of the root composer.json?

    @atawench Adding the patch in the root composer.json is how it should be done properly.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States datawench

    Got it. Many thanks.

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

Production build 0.71.5 2024