Skip to content

Commit

Permalink
Fix for HTTP_* values with explicit copy entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralouphie committed Feb 11, 2016
1 parent 05c6a7e commit 5486a59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/getallheaders.php
Expand Up @@ -20,7 +20,7 @@ function getallheaders()
foreach ($_SERVER as $key => $value) {
if (substr($key, 0, 5) === 'HTTP_') {
$key = substr($key, 5);
if (!isset($copy_server[$key])) {
if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) {
$key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key))));
$headers[$key] = $value;
}
Expand Down
9 changes: 9 additions & 0 deletions tests/GetAllHeadersTest.php
Expand Up @@ -51,6 +51,15 @@ public function testWorksData()
'HTTP_CONTENT_LENGTH' => '111'
)
),
array(
'Content-Length (HTTP_CONTENT_LENGTH only)',
array(
'Content-Length' => '111'
),
array(
'HTTP_CONTENT_LENGTH' => '111'
)
),
array(
'Content-MD5',
array(
Expand Down

0 comments on commit 5486a59

Please sign in to comment.