diff --git a/src/ServerRequestFactory.php b/src/ServerRequestFactory.php index 3b767222..3bc5ede5 100644 --- a/src/ServerRequestFactory.php +++ b/src/ServerRequestFactory.php @@ -211,7 +211,11 @@ public static function marshalHeaders(array $server) if ($value && strpos($key, 'HTTP_') === 0) { $name = strtr(strtolower(substr($key, 5)), '_', '-'); - $headers[$name] = $value; + + if (! is_numeric($name)) { + $headers[$name] = $value; + } + continue; } diff --git a/test/ServerRequestFactoryTest.php b/test/ServerRequestFactoryTest.php index 63f202e1..35ebf53b 100644 --- a/test/ServerRequestFactoryTest.php +++ b/test/ServerRequestFactoryTest.php @@ -62,6 +62,7 @@ public function testMarshalsExpectedHeadersFromServerArray() 'HTTP_CONTENT_TYPE' => 'application/json', 'HTTP_ACCEPT' => 'application/json', 'HTTP_X_FOO_BAR' => 'FOOBAR', + 'HTTP__1' => '-1', 'CONTENT_MD5' => 'CONTENT-MD5', 'CONTENT_LENGTH' => 'UNSPECIFIED', ];