Skip to content

Commit f0bc858

Browse files
committed
Fix php-curl-class#257: Preserve space in cookie delimiter
1 parent 443aa73 commit f0bc858

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Curl/Curl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,10 @@ public function setDigestAuthentication($username, $password = '')
543543
*/
544544
public function setCookie($key, $value)
545545
{
546-
$this->cookies[$key] = $value;
547-
$this->setOpt(CURLOPT_COOKIE, implode('; ', array_map(function($name) {
548-
return $name . '=' . str_replace(' ', '%20', $this->cookies[$name]);
549-
}, array_keys($this->cookies))));
546+
$this->cookies[$key] = $value;
547+
$this->setOpt(CURLOPT_COOKIE, implode('; ', array_map(function($this, $name) {
548+
return $name . '=' . str_replace(' ', '%20', $this->cookies[$name]);
549+
}, array($this), array_keys($this->cookies))));
550550
}
551551

552552
/**

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ public function testCookieEncodingSpace()
661661
$options = $reflectionProperty->getValue($curl);
662662
$this->assertEquals('cookie=Om%20nom%20nom%20nom', $options[CURLOPT_COOKIE]);
663663
}
664-
664+
665665
public function testMultipleCookies()
666666
{
667667
$curl = new Curl();

0 commit comments

Comments
 (0)