guzzle / guzzle

Guzzle, an extensible PHP HTTP client

Home Page:https://docs.guzzlephp.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP 8.1 Compatibility issue: Deprecated: Implicit conversion from float xxx.xxxx to int loses precision

eyeskiller opened this issue · comments

Guzzle version(s) affected: 6.3
PHP version: 8.1.12
cURL version: 7.74.0

Description
In file CurlMultiHandler you are passing float to usleep function which is converted to int afterwards. This throws error: Deprecated: Implicit conversion from float xxx.xxxx to int loses precision.

How to reproduce
Use CurlMultiHandler on PHP 8.1

Possible Solution

    public function execute()
    {
        $queue = P\queue();

        while ($this->handles || !$queue->isEmpty()) {
            // If there are no transfers, then sleep for the next delay
            if (!$this->active && $this->delays) {
                usleep((int) ($this->timeToNext()));
            }

Additional context

I just figure out that it's fixed in 7.x version. Sorry. Closing issue.

Guzzle 6 does not support PHP 8 at all, btw. You can only use Guzzle 6 on PHP 5.5.9 through to 7.4.999.