diff --git a/src/CurlMulti.php b/src/CurlMulti.php index 75e5a6b..a16fcea 100644 --- a/src/CurlMulti.php +++ b/src/CurlMulti.php @@ -20,10 +20,10 @@ class CurlMulti private $using = array(); /** @var CopyRequest[] */ - private $requests; + private $requests = array(); /** @var CopyRequest[] */ - private $runningRequests; + private $runningRequests = array(); /** @var bool */ private $permanent = true; diff --git a/tests/unit/CurlMultiTest.php b/tests/unit/CurlMultiTest.php index b22dc3f..0318464 100644 --- a/tests/unit/CurlMultiTest.php +++ b/tests/unit/CurlMultiTest.php @@ -71,4 +71,13 @@ public function testWait() $content = stream_get_contents($tmpfile); $this->assertEmpty($content); } + + public function testCountable() { + $multi = new CurlMulti; + // Both of the methods are using the class properties that are defined as "null" initially and if we'll + // pass that state to "count()" the "Parameter must be an array or an object that implements Countable" + // error will be thrown. + $multi->setupEventLoop(); + $multi->remain(); + } }