This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
Some type of set-cookie issue #114
Closed
Description
Look at this cookie from http://www.chessgames.com/perl/chesslogin.pl
Set-Cookie: chessID=6251262; path=/; expires=Thu, 20-Feb-2020 09:28:42 GMT
The code below gets a cookie jar that has a array with a numerical key 0. I think this is because the domain is null. Well it turns out that setCookies eventually calls addCookie(name, value). Then somewhere in addCookie it checks a case if name is a string and uses value. Well that's the case it's probably supposed to hit but since somewhere that array key got null, it turned into 0, and it throws an invalid type exception.
$httpClient->setUri($params['loginUrl']);
$httpClient->setParameterPost([
'name' => $params['username'],
'password' => $params['password']
]);
$response = $httpClient->setMethod('POST')->send();
$cookiejar = \Zend\Http\Cookies::fromResponse($response, ""); <----nothing in that second param works and that's probably part of the problem
$httpClient->setCookies($cookiejar->getAllCookies());