diff --git a/src/Message.php b/src/Message.php index 9b74b8d4..6e6c3e51 100644 --- a/src/Message.php +++ b/src/Message.php @@ -33,7 +33,7 @@ public static function toString(MessageInterface $message): string } foreach ($message->getHeaders() as $name => $values) { - if (strtolower($name) === 'set-cookie') { + if (is_string($name) && strtolower($name) === 'set-cookie') { foreach ($values as $value) { $msg .= "\r\n{$name}: ".$value; } diff --git a/src/MessageTrait.php b/src/MessageTrait.php index a85d3ab2..e05ebea8 100644 --- a/src/MessageTrait.php +++ b/src/MessageTrait.php @@ -12,10 +12,10 @@ */ trait MessageTrait { - /** @var array Map of all registered headers, as original name => array of values */ + /** @var string[][] Map of all registered headers, as original name => array of values */ private $headers = []; - /** @var array Map of lowercase header name => original name at registration */ + /** @var string[] Map of lowercase header name => original name at registration */ private $headerNames = []; /** @var string */