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

Commit aa4ee94

Browse files
committed
Allow setting (int) 0 as Expires
1 parent 6253e9b commit aa4ee94

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Header/Expires.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getFieldName()
3232

3333
public function setDate($date)
3434
{
35-
if ($date === '0') {
35+
if ($date === '0' || $date === 0) {
3636
$date = date(DATE_W3C, 0); // Thu, 01 Jan 1970 00:00:00 GMT
3737
}
3838
return parent::setDate($date);

test/Header/ExpiresTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,9 @@ public function testExpiresSetToZero()
6363
$expires = new Expires();
6464
$expires->setDate('0');
6565
$this->assertEquals('Expires: Thu, 01 Jan 1970 00:00:00 GMT', $expires->toString());
66+
67+
$expires = new Expires();
68+
$expires->setDate(0);
69+
$this->assertEquals('Expires: Thu, 01 Jan 1970 00:00:00 GMT', $expires->toString());
6670
}
6771
}

0 commit comments

Comments
 (0)