Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 8ddc3b6

Browse files
committed
Merge branch 'hotfix/344'
Close #344 Fixes #342
2 parents 3a7562d + a1bb167 commit 8ddc3b6

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ All notable changes to this project will be documented in this file, in reverse
2222

2323
### Fixed
2424

25-
- Nothing.
25+
- [#344](https://github.com/zendframework/zend-diactoros/pull/344) provides a fix to ensure that headers with a value of "0" are retained.
2626

2727
## 2.0.1 - 2018-12-03
2828

src/functions/marshal_headers_from_sapi.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ function marshalHeadersFromSapi(array $server) : array
4646
$headers[$name] = $value;
4747
continue;
4848
}
49+
50+
$headers[$key] = $value;
4951
}
5052

5153
return $headers;

test/ServerRequestFactoryTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,18 @@ public function testFromGlobalsUsesCookieHeaderInsteadOfCookieSuperGlobal()
421421
$this->assertSame(['foo_bar' => 'baz'], $request->getCookieParams());
422422
}
423423

424+
/**
425+
* @runInSeparateProcess
426+
* @preserveGlobalState
427+
*/
428+
public function testCreateFromGlobalsShouldPreserveKeysWhenCreatedWithAZeroValue()
429+
{
430+
$_SERVER['Accept'] = '0';
431+
432+
$request = ServerRequestFactory::fromGlobals();
433+
$this->assertSame('0', $request->getHeaderLine('Accept'));
434+
}
435+
424436
/**
425437
* @runInSeparateProcess
426438
* @preserveGlobalState disabled

0 commit comments

Comments
 (0)