Fix #257: Preserve space in cookie delimiter

This commit is contained in:
Zach Borboa
2015-10-27 21:29:38 -07:00
parent 443aa73851
commit f0bc858897
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -543,10 +543,10 @@ class Curl
*/
public function setCookie($key, $value)
{
$this->cookies[$key] = $value;
$this->setOpt(CURLOPT_COOKIE, implode('; ', array_map(function($name) {
return $name . '=' . str_replace(' ', '%20', $this->cookies[$name]);
}, array_keys($this->cookies))));
$this->cookies[$key] = $value;
$this->setOpt(CURLOPT_COOKIE, implode('; ', array_map(function($this, $name) {
return $name . '=' . str_replace(' ', '%20', $this->cookies[$name]);
}, array($this), array_keys($this->cookies))));
}
/**
+1 -1
View File
@@ -661,7 +661,7 @@ class CurlTest extends PHPUnit_Framework_TestCase
$options = $reflectionProperty->getValue($curl);
$this->assertEquals('cookie=Om%20nom%20nom%20nom', $options[CURLOPT_COOKIE]);
}
public function testMultipleCookies()
{
$curl = new Curl();