Skip to content

Commit 0c070b2

Browse files
author
Ich
committed
renamed getCookie to getResponseCookie
Making clear that you get the Cookies of the response, not the ones you set initially.
1 parent 7b4d4da commit 0c070b2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Curl/Curl.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Curl
3737
private $completeFunction = null;
3838

3939
private $cookies = array();
40+
private $responseCookies = array();
4041
private $headers = array();
4142
private $options = array();
4243

@@ -304,7 +305,7 @@ public function exec($ch = null)
304305
$this->rawResponse = curl_exec($this->curl);
305306
$this->curlErrorCode = curl_errno($this->curl);
306307
}
307-
308+
$this->responseCookies = array();
308309
$this->curlErrorMessage = curl_error($this->curl);
309310
$this->curlError = !($this->curlErrorCode === 0);
310311
$this->httpStatusCode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
@@ -402,7 +403,7 @@ public function head($url, $data = array())
402403
public function headerCallback($ch, $header)
403404
{
404405
if (preg_match('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi', $header, $cookie) == 1) {
405-
$this->cookies[$cookie[1]] = $cookie[2];
406+
$this->responseCookies[$cookie[1]] = $cookie[2];
406407
}
407408
$this->rawResponseHeaders .= $header;
408409
return strlen($header);
@@ -543,13 +544,13 @@ public function setCookie($key, $value)
543544
}
544545

545546
/**
546-
* get Cookie
547+
* get Cookie of Response
547548
*
548549
* @access public
549550
* @param $key
550551
*/
551-
public function getCookie($key) {
552-
return $this->cookies[$key];
552+
public function getResponseCookie($key) {
553+
return $this->responseCookies[$key];
553554
}
554555

555556
/**

0 commit comments

Comments
 (0)