algoliasearch-client-php
algoliasearch-client-php copied to clipboard
PSR http message version conflict
- Algolia Client Version: 3.4.0, 3.4.1
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.
Same happens with Shopware 5.x (and a self-implemented Algolia client). Pinning the version to 3.2.2 solves the problem for us.
Promoting this issue using:
- PHP 8.1
- Algolia Client Version: 3.4.0, 3.4.1 (custom wordpress plugin)
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
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.