Skip to content

Commit 9d1b718

Browse files
authored
Merge pull request #317 from Geolim4/final
Fixed critical bug with date calculation
2 parents 33ab90a + c039f50 commit 9d1b718

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/phpFastCache/Cache/ItemBaseTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ public function expiresAfter($time)
174174
*/
175175
$time = 30 * 24 * 3600 * 5;
176176
}
177-
$this->expirationDate = $this->expirationDate->add(new \DateInterval(sprintf('PT%dS', $time)));
177+
$this->expirationDate = (new \DateTime())->add(new \DateInterval(sprintf('PT%dS', $time)));
178178
} else if ($time instanceof \DateInterval) {
179-
$this->expirationDate = $this->expirationDate->add($time);
179+
$this->expirationDate = (new \DateTime())->add($time);
180180
} else {
181181
throw new \InvalidArgumentException('Invalid date format');
182182
}

0 commit comments

Comments
 (0)