mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Merge pull request #245 from zachborboa/master
Close MultiCurl resource only when still open
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ namespace Curl;
|
||||
|
||||
class Curl
|
||||
{
|
||||
const VERSION = '4.7.0';
|
||||
const VERSION = '4.7.1';
|
||||
const DEFAULT_TIMEOUT = 30;
|
||||
|
||||
public $curl;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user