Skip to content

Commit 47f5ad8

Browse files
committed
Fix server crash when header with only digits in name sended
1 parent 1922714 commit 47f5ad8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

psalm.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,10 @@
2727
<directory name="src" />
2828
</errorLevel>
2929
</PropertyNotSetInConstructor>
30+
<RedundantCastGivenDocblockType>
31+
<errorLevel type="suppress">
32+
<directory name="src" />
33+
</errorLevel>
34+
</RedundantCastGivenDocblockType>
3035
</issueHandlers>
3136
</psalm>

src/Server/Http/Psr7/MessageTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,14 @@ public function withBody(StreamInterface $body): MessageInterface
141141
private function setHeaders(array $headers): void
142142
{
143143
foreach ($headers as $name => $value) {
144-
$normalizedName = $this->normalizeHeaderName($name);
145-
$value = $this->normalizeHeaderValue($value);
144+
$normalizedName = $this->normalizeHeaderName((string) $name);
145+
$valuse = $this->normalizeHeaderValue($value);
146146
if (isset($this->headerNames[$normalizedName])) {
147147
$name = $this->headerNames[$normalizedName];
148-
$this->headers[$name] = \array_merge($this->headers[$name], $value);
148+
$this->headers[$name] = \array_merge($this->headers[$name], $valuse);
149149
} else {
150150
$this->headerNames[$normalizedName] = $name;
151-
$this->headers[$name] = $value;
151+
$this->headers[$name] = $valuse;
152152
}
153153
}
154154
}

0 commit comments

Comments
 (0)