Skip to content

Commit

Permalink
Fix SapiNormalizer::normalizeHeaders() method
Browse files Browse the repository at this point in the history
  • Loading branch information
devanych committed Jul 20, 2021
1 parent 22c70c7 commit 6552246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SapiNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function normalizeHeaders(array $server): array
$headers = [];

foreach ($server as $name => $value) {
if (!is_string($name) || $value === '') {
if (!is_string($name)) {
continue;
}

Expand All @@ -102,6 +102,7 @@ public function normalizeHeaders(array $server): array

if (strpos($name, 'HTTP_') === 0) {
$headers[$this->normalizeHeaderName(substr($name, 5))] = $value;
continue;
}

if (strpos($name, 'CONTENT_') === 0) {
Expand Down
1 change: 1 addition & 0 deletions tests/SapiNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function setUp(): void
{
$this->normalizer = new SapiNormalizer();
$this->server = [
'value-without-name',
'HTTPS' => 'on',
'SERVER_PORT' => '443',
'REQUEST_METHOD' => 'GET',
Expand Down

0 comments on commit 6552246

Please sign in to comment.