cURL error 2: easy handle already used in multi handle with laravel 6 , laravel/scocialite

Viewed 608

While implementing "laravel/socialite": "^4.3.2" in laravel 6 I am facing an issue cURL error 2: easy handle already used in multi handle

If I change/fix the release() function from GuzzleHttp\Handler\CurlFactory to according to the codes/pictures below it works just fine.

Now I don't really want to modify the codes in vendor.If I release a customized package for GuzzleHttp\Handler\CurlFactory in package in packagelyst it may work but I am not sure if that will be a good solution as this is a core library.

What would be the other approach to solve this issue? In server the php version is 7.2 and the curl version is 7.69

Modified code

public function release(EasyHandle $easy)
    {
        $resource = $easy->handle;
        unset($easy->handle);

        curl_close($resource);

        /*if (count($this->handles) >= $this->maxHandles) {
            curl_close($resource);
        } else {
            // Remove all callback functions as they can hold onto references
            // and are not cleaned up by curl_reset. Using curl_setopt_array
            // does not work for some reason, so removing each one
            // individually.
            curl_setopt($resource, CURLOPT_HEADERFUNCTION, null);
            curl_setopt($resource, CURLOPT_READFUNCTION, null);
            curl_setopt($resource, CURLOPT_WRITEFUNCTION, null);
            curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null);
            curl_reset($resource);
            $this->handles[] = $resource;
        }*/
    }

Original code

public function release(EasyHandle $easy)
    {
        $resource = $easy->handle;
        unset($easy->handle);

        if (count($this->handles) >= $this->maxHandles) {
            curl_close($resource);
        } else {
            // Remove all callback functions as they can hold onto references
            // and are not cleaned up by curl_reset. Using curl_setopt_array
            // does not work for some reason, so removing each one
            // individually.
            curl_setopt($resource, CURLOPT_HEADERFUNCTION, null);
            curl_setopt($resource, CURLOPT_READFUNCTION, null);
            curl_setopt($resource, CURLOPT_WRITEFUNCTION, null);
            curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null);
            curl_reset($resource);
            $this->handles[] = $resource;
        }
    }

enter image description here enter image description here

0 Answers
Related