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

Commit

Permalink
PR zendframework/zendframework#4588 merged to master
Browse files Browse the repository at this point in the history
Merge branch 'rodsouto-issue_4583'
  • Loading branch information
Ralph Schindler committed Jun 6, 2013

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Header/GenericHeader.php
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ public function __construct($fieldName = null, $fieldValue = null)
$this->setFieldName($fieldName);
}

if ($fieldValue) {
if ($fieldValue !== null) {
$this->setFieldValue($fieldValue);
}
}
@@ -103,7 +103,7 @@ public function setFieldValue($fieldValue)
{
$fieldValue = (string) $fieldValue;

if (empty($fieldValue) || preg_match('/^\s+$/', $fieldValue)) {
if (preg_match('/^\s+$/', $fieldValue)) {
$fieldValue = '';
}

7 changes: 7 additions & 0 deletions test/HeadersTest.php
Original file line number Diff line number Diff line change
@@ -270,4 +270,11 @@ public function testCastingToStringReturnsAllMultiHeaderValues()
$expected = implode("\r\n", $expected) . "\r\n";
$this->assertEquals($expected, $string);
}

public function testZeroIsAValidHeaderValue()
{
$headers = Headers::fromString('Fake: 0');
$this->assertSame('0', $headers->get('Fake')->getFieldValue());
}

}

0 comments on commit b5e6fa9

Please sign in to comment.