algolia / algoliasearch-client-php

⚡️ A fully-featured and blazing-fast PHP API client to interact with Algolia.
https://www.algolia.com/doc/api-client/php/getting-started/
MIT License
671 stars 116 forks source link

PSR http message version conflict #724

Open NicolasPineau opened 11 months ago

NicolasPineau commented 11 months ago

Description

composer./json states that either versions 1 or 2 of psr http-message are compliant :

"psr/http-message": "^1.0 || ^2.0",

In class Algolia\AlgoliaSearch\Http\Psr7\Uri the method withScheme has the following signature :

https://github.com/algolia/algoliasearch-client-php/blob/df4508d6ca85700d2df9b556edd18696f37fb2cd/src/Http/Psr7/Uri.php#L439

which is not correct implementation of version 1 of psr/http-message related interface:

public function withScheme(string $scheme);

Experienced by using "drupal/search_api_algolia": "^3.0@beta", had to downgrade algolia/algoliasearch-client-php to 3.3.2 fo fix.

mariofischer commented 10 months ago

Same happens with Shopware 5.x (and a self-implemented Algolia client). Pinning the version to 3.2.2 solves the problem for us.

sushidub commented 10 months ago

Promoting this issue using:

The PSR conflict logs as:

PHP Fatal error: Declaration of Algolia\AlgoliaSearch\Http\Psr7\Uri::withScheme(string $scheme): Psr\Http\Message\UriInterface must be compatible with Psr\Http\Message\UriInterface::withScheme($scheme) in /code/wp-content/plugins/algolia/vendor/algolia/algoliasearch-client-php/src/Http/Psr7/Uri.php on line 439

Temporary Fix: Downgraded Algolia client to version to 3.2.2

CedsTrash commented 9 months ago

Hi, do we know more about this issue? It doesn't feel right to have to pin this package to version 3.3.2.

Thanks.