This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ All notable changes to this project will be documented in this file, in reverse
24
24
25
25
### Fixed
26
26
27
- - Nothing.
27
+ - [ #87 ] ( https://github.com/zendframework/zend-http/pull/87 ) fixes the
28
+ ` ContentLength ` constructor to test for a non null value (vs a falsy value)
29
+ before validating the value; this ensures 0 values may be specified for the
30
+ length.
28
31
29
32
## 2.5.4 - 2016-02-04
30
33
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public static function fromString($headerLine)
40
40
41
41
public function __construct ($ value = null )
42
42
{
43
- if ($ value ) {
43
+ if (null !== $ value ) {
44
44
HeaderValue::assertValid ($ value );
45
45
$ this ->value = $ value ;
46
46
}
Original file line number Diff line number Diff line change @@ -65,4 +65,11 @@ public function testPreventsCRLFAttackViaConstructor()
65
65
$ this ->setExpectedException ('Zend\Http\Header\Exception\InvalidArgumentException ' );
66
66
$ header = new ContentLength ("Content-Length: xxx \r\n\r\nevilContent " );
67
67
}
68
+
69
+ public function testZeroValue ()
70
+ {
71
+ $ contentLengthHeader = new ContentLength (0 );
72
+ $ this ->assertEquals (0 , $ contentLengthHeader ->getFieldValue ());
73
+ $ this ->assertEquals ('Content-Length: 0 ' , $ contentLengthHeader ->toString ());
74
+ }
68
75
}
You can’t perform that action at this time.
0 commit comments