Skip to content

Commit

Permalink
Fix issue where PHP transforms numeric strings in array keys to ints
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Aug 27, 2023
1 parent 8bd7c33 commit 8371ba0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/MessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
*/
trait MessageTrait
{
/** @var array<string, string[]> 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<string, string> Map of lowercase header name => original name at registration */
/** @var string[] Map of lowercase header name => original name at registration */
private $headerNames = [];

/** @var string */
Expand Down

0 comments on commit 8371ba0

Please sign in to comment.