guzzle / psr7

PSR-7 HTTP message library
MIT License
7.88k stars 3 forks source link

Header::parse loosing cookies with same name #586

Open hayden-t opened 11 months ago

hayden-t commented 11 months ago

I believe im running guzzle 2.5.0 under PHP 8.1, which the parse function more or less looks identical to current master.

example (2 cookies set, one for / and the other /admin) both are sent in a GET even in strict mode

$cookiesHeader = $conn->httpRequest->getHeader('Cookie')
var_dump($cookiesHeader);

array(1) {
  [0]=>
  string(271) "OCSESSID=3fc4524dcf596uued26f5b6481;  OCSESSID=8f5a45uu3f340f8b4a7ec145b7"
}

but if

$cookies = Header::parse($cookiesHeader);
var_dump($cookies);

array(1) {
  [0]=>
  array(1) {
    ["OCSESSID"]=>
    string(26) "8f5a453f340f8b49ea7ec145b7"
  }
}

Thank you ! https://github.com/guzzle/psr7/blob/45b30f99ac27b5ca93cb4831afe16285f57b8221/src/Header.php#L17