Closed MaxBoeh closed 1 year ago
@MaxBoeh I just checked using v1 of psr/http-message and the latest Elasticsearch response implementation and it works thanks to the Covariant Returns and Contravariant Parameters of PHP from 7.4+. Can you check please:
composer update
composer info
regarding the psr/http-message
and elasticsearch/elasticsearch
?Thanks.
I ran into this just now, and it turns out we were using psr/http-message
version 1.0.1, but it only worked using version 1.1, where they added typehints to parameters
I had to remove the tag v8.8.1 because it has been released before the official schedule. The tag v8.8.1 will be re-created soon in a few days. Sorry for any inconvenience
I just checked out the branch where I had the issue, tried it again, same php version, same composer.lock and it just works. I'm a bit baffled. I'm kind of glad others experienced the same issue 😅
I'm on psr/http-message
1.1, with elasticsearch/elasticsearch 8.8.1 and also tried 8.8.0
composer info psr/http-message
name : psr/http-message descrip. : Common interface for HTTP messages keywords : http, http-message, psr, psr-7, request, response versions : * 1.1 type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : https://github.com/php-fig/http-message source : [git] https://github.com/php-fig/http-message.git cb6ce4845ce34a8ad9e68117c10ee90a29919eba dist : [zip] https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba cb6ce4845ce34a8ad9e68117c10ee90a29919eba path : /mnt/c/Users/maxbo/git-workspace/nerdkap/ecommerce-affiliates/vendor/psr/http-message names : psr/http-message
support source : https://github.com/php-fig/http-message/tree/1.1
autoload psr-4 Psr\Http\Message\ => src/
requires php ^7.2 || ^8.0
composer info elasticsearch/elasticsearch
name : elasticsearch/elasticsearch descrip. : PHP Client for Elasticsearch keywords : client, elastic, elasticsearch, search versions : * v8.8.0 type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : source : [git] git@github.com:elastic/elasticsearch-php.git 5c4d67870b92fedc06fcceec5be8c3be8563fe3d dist : [zip] https://api.github.com/repos/elastic/elasticsearch-php/zipball/5c4d67870b92fedc06fcceec5be8c3be8563fe3d 5c4d67870b92fedc06fcceec5be8c3be8563fe3d path : /mnt/c/Users/maxbo/git-workspace/nerdkap/ecommerce-affiliates/vendor/elasticsearch/elasticsearch names : elasticsearch/elasticsearch
autoload psr-4 Elastic\Elasticsearch\ => src/
requires elastic/transport ^8.7 guzzlehttp/guzzle ^7.0 php ^7.4 || ^8.0 psr/http-client ^1.0 psr/http-message ^1.0 psr/log ^1|^2|^3
requires (dev) ext-yaml ext-zip mockery/mockery ^1.5 nyholm/psr7 ^1.5 php-http/message-factory ^1.1 php-http/mock-client ^1.5 phpstan/phpstan ^1.4 phpunit/phpunit ^9.5 symfony/finder ~4.0 symfony/http-client ^5.0|^6.0
@MaxBoeh please use "elasticsearch/elasticsearch" : "=8.8.0"
in your composer.json
and run composer update
. Let me know, thanks.
@ezimuel It works fine now. I have no idea what has changed on my end.
For me the issue can be closed, thank you for your support.
Summary of problem or feature request
The version constraint of dependency
"psr/http-message": "^1.0 || ^2.0"
is not correct, as for version 1
\Psr\Http\Message\ResponseInterface::withStatus
looks like this:While the implementation in
\Elastic\Elasticsearch\Traits\MessageResponseTrait::withStatus
looks like this:Leading to this fatal error:
Please remove v1 of psr/http-message from the version constraint.
System details