Merge pull request #245 from zachborboa/master

Close MultiCurl resource only when still open
This commit is contained in:
Zach Borboa
2015-09-18 01:27:14 -07:00
3 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ namespace Curl;
class Curl
{
const VERSION = '4.7.0';
const VERSION = '4.7.1';
const DEFAULT_TIMEOUT = 30;
public $curl;
+3 -1
View File
@@ -261,7 +261,9 @@ class MultiCurl
$ch->close();
}
curl_multi_close($this->multiCurl);
if (is_resource($this->multiCurl)) {
curl_multi_close($this->multiCurl);
}
}
/**
@@ -1988,4 +1988,14 @@ class MultiCurlTest extends PHPUnit_Framework_TestCase
$this->assertTrue(in_array($url, $urls_called, true));
}
}
public function testClose()
{
$multi_curl = new MultiCurl();
$multi_curl->addGet(Test::TEST_URL);
$multi_curl->start();
$this->assertTrue(is_resource($multi_curl->multiCurl));
$multi_curl->close();
$this->assertFalse(is_resource($multi_curl->multiCurl));
}
}