Fixes setcookie to only send one Set-Cookie header per name

According to the IETF RFC 6265, only one Set-Cookie header should be sent per cookie name.

Fixes https://bugs.php.net/bug.php?id=67736

Cherry-picks and adapts 208deda (#795) for master