Guzzle: Crash CurlFactory:67 - PHP 7.2.0-dev

Created on 21 Feb 2017  路  4Comments  路  Source: guzzle/guzzle

Hi,

just letting know that request will fail in unit test (due warning).

You can run the test in this repo. Easy query with basic auth with a 401 exception.

Thank you,

1) SmartEmailing\v3\Tests\Request\Credentials\CredentialsLiveTest::testSend401
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:67
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:107
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php:43
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:28
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:51
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:42
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Middleware.php:30
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:68
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Middleware.php:59
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/HandlerStack.php:67
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Client.php:275
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Client.php:123
/home/travis/build/pionl/smart-emailing-v3/vendor/guzzlehttp/guzzle/src/Client.php:129
/home/travis/build/pionl/smart-emailing-v3/src/Request/AbstractRequest.php:66
/home/travis/build/pionl/smart-emailing-v3/src/Request/Credentials/Credentials.php:24
/home/travis/build/pionl/smart-emailing-v3/tests/Request/Credentials/CredentialsLiveTest.php:36

Most helpful comment

Having a problem in CurlFactory.php and PHP 7.2 and MailGun:

count($this->handles) - handles is null and throwing an error.

Fixed with checking for a null value:

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

        // fix for PHP 7.2 gmize - 4/23/18 - added check for $this->handles = null
        if ($this->handles && (count($this->handles) >= $this->maxHandles)) {
            curl_close($resource);
        } else {
            curl_reset($resource);
            $this->handles[] = $resource;
        }
    }

This works for me.

Comments?

All 4 comments

Should be fixed with #1686, but this fix is not yet released. Could a release be created that includes this fix?

Released in 6.3.0

Having a problem in CurlFactory.php and PHP 7.2 and MailGun:

count($this->handles) - handles is null and throwing an error.

Fixed with checking for a null value:

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

        // fix for PHP 7.2 gmize - 4/23/18 - added check for $this->handles = null
        if ($this->handles && (count($this->handles) >= $this->maxHandles)) {
            curl_close($resource);
        } else {
            curl_reset($resource);
            $this->handles[] = $resource;
        }
    }

This works for me.

Comments?

Im still having that problem where count(nil) throws an error. Can't upgrade to php 7.2 because of that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tzookb picture tzookb  路  5Comments

julianhaines picture julianhaines  路  5Comments

novuscom picture novuscom  路  3Comments

gmponos picture gmponos  路  5Comments

kradkahaddi picture kradkahaddi  路  3Comments