influxdata / influxdb-client-php

InfluxDB (v2+) Client Library for PHP
https://influxdata.github.io/influxdb-client-php/
MIT License
150 stars 47 forks source link

Switch Guzzle dependency to version 7 to prevent deprecation notices thrown in PHP 8.1 #113

Closed cstuder closed 2 years ago

cstuder commented 2 years ago

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

  1. Run any method which uses HTTP with PHP 8.1 and notices enabled

Expected behavior: No notices being thrown, silent execution.

Actual behavior: Notice thrown:

Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /.../vendor/guzzlehttp/guzzle/src/Client.php on line 445

Notes

PHP 8.1 has tightened parameter types. Guzzle version 6 is affected and according to their issues will not fix this deprecation notice, because Guzzle version 7 is the only supported one.

influxdata/influxdb-client-php allows for both version in the composer.json requirements:

"guzzlehttp/guzzle": "^6.2|^7.0.1",

This should be fixed to version 7 only.

Specifications:

cstuder commented 2 years ago

Maybe changing the dependency string alone is sufficient, but I wasn't able to run the tests on my machine for the moment. The Dockerfile would have to be changed to PHP8.1 as well, at least for running the tests.

bednar commented 2 years ago

Hi @cstuder,

thanks for using our client.

I will prepare PR to change a supported version of PHP to 7.2. Meanwhile you can install your preferred version of guzzle by:

composer require guzzlehttp/guzzle:^7.0.1 guzzlehttp/psr7:^1.7

The Dockerfile would have to be changed to PHP8.1 as well, at least for running the tests.

We want to use minimal supported version of PHP as a base for tests. The other version of PHP are tested in CI: https://app.circleci.com/pipelines/github/influxdata/influxdb-client-php

Regards

bednar commented 2 years ago

Hi @cstuder,

I've prepared PR #114. If you would like to use a dev version of client then install client via:

composer require influxdata/influxdb-client-php:master

Regards