elastic / elasticsearch-php

Official PHP client for Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
MIT License
5.26k stars 965 forks source link

PHP 8.2 compatibility in Elasticsearch PHP client version 7 #1256

Closed asgrim closed 1 year ago

asgrim commented 1 year ago

Summary of problem or feature request

Elasticsearch PHP client claims it is compatible with PHP 8.2:

https://github.com/elastic/elasticsearch-php/blob/1890f9d7fde076b5a3ddcf579a802af05b2e781b/composer.json#L19

When installing elasticsearch/elasticsearch:^7.0 running PHP 8.2.0RC2 and making some requests, I get the following deprecation warning:

Deprecated: Creation of dynamic property GuzzleHttp\Ring\Client\CurlMultiHandler::$_mh is deprecated in /tmp/scout_elastic_test/vendor/ezimuel/ringphp/src/Client/CurlMultiHandler.php on line 47

I have submitted an upstream patch ezimuel/ringphp#7 which should fix the above, but I'm not sure if it has been noticed yet.

From my basic checks, it otherwise seems compatible.

Code snippet of problem

Our full test for ES7 compatibility is here.

$client = \Elasticsearch\ClientBuilder::create()->build();

$client->index(['index' => 'my_index', 'id' => 'my_id', 'body' => ['testField' => 'abc']]);
$client->get(['index' => 'my_index', 'id' => 'my_id']);
$client->search(['index' => 'my_index', 'body' => ['query' => ['match' => ['testField' => 'abc']]]]);
$client->delete(['index' => 'my_index', 'id' => 'my_id']);

System details

ezimuel commented 1 year ago

@asgrim thanks for the PR, I'll check asap.

asgrim commented 1 year ago

Please note I also made a follow-up bugfix ezimuel/ringphp#9 not sure if you saw yet :+1: