Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\google\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67

If you encountered this problem, you can easily fix this by simply following instruction below.

The problem with this is in PHP 7.2+ the parameter for count() can’t be NULL. The warning gets displayed when $this->handles equals NULL.

So to fix this, just go to the CurlFactory.php file inside the vendor folder on your PHP project. You can go there by clicking the vendor folder > guzzlehttp > guzzle > src > Handler and you can see now the CurlFactory.php.

After that, you need to replace line 67 in CurlFactory.php with the following ( like what the picture shown below, just ignore the line error as it not affect your PHP project ) :

if (($this->handles ? count($this->handles) : 0) >= $this->maxHandles) {

Reference:
https://github.com/googleapis/google-api-php-client/issues/1392

Leave a Comment

Your email address will not be published. Required fields are marked *