When reading the last response headers, it seems that it does not contain all "set-cookie" headers.
I think that the response headers are just put into an associative array, which will not work, since the "set-cookie" header can appear multiple times. This might as well affect other headers.
Thus, putting all headers into one associative array is not a good idea.