Skip to content

Commit c711afd

Browse files
[HttpKernel] Account for Response::getDate() possibly returning a DateTimeImmutable
1 parent d6e45e4 commit c711afd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

HttpCache/ResponseCacheStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function update(Response $response)
147147

148148
if (is_numeric($this->ageDirectives['expires'])) {
149149
$date = clone $response->getDate();
150-
$date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
150+
$date = $date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
151151
$response->setExpires($date);
152152
}
153153
}

Tests/HttpCache/ResponseCacheStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public function testCacheControlMerging(array $expects, array $master, array $su
257257

258258
case 'expires':
259259
$expires = clone $response->getDate();
260-
$expires->modify('+'.$value.' seconds');
260+
$expires = $expires->modify('+'.$value.' seconds');
261261
$response->setExpires($expires);
262262
break;
263263

0 commit comments

Comments
 (0)