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

Commit

Permalink
Allow setting (int) 0 as Expires
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Jan 25, 2017
1 parent 6253e9b commit aa4ee94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Header/Expires.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function getFieldName()

public function setDate($date)
{
if ($date === '0') {
if ($date === '0' || $date === 0) {
$date = date(DATE_W3C, 0); // Thu, 01 Jan 1970 00:00:00 GMT
}
return parent::setDate($date);
Expand Down
4 changes: 4 additions & 0 deletions test/Header/ExpiresTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,9 @@ public function testExpiresSetToZero()
$expires = new Expires();
$expires->setDate('0');
$this->assertEquals('Expires: Thu, 01 Jan 1970 00:00:00 GMT', $expires->toString());

$expires = new Expires();
$expires->setDate(0);
$this->assertEquals('Expires: Thu, 01 Jan 1970 00:00:00 GMT', $expires->toString());
}
}

0 comments on commit aa4ee94

Please sign in to comment.