8000 [5.6] Fix cache repository (#26496) · laravel/framework@b12feab · GitHub
[go: up one dir, main page]

Skip to content

Commit b12feab

Browse files
driesvintstaylorotwell
authored andcommitted
[5.6] Fix cache repository (#26496)
* Fix a bug with PHP 7.2.12 PHP 7.2.12 broke the way Carbon's diffInSeconds method works. Using diffInRealSeconds instead fixes the problem. See briannesbitt/Carbon#1503 * Clean up diff check in cache repository We can pass the duration here directly. Signed-off-by: Dries Vints <dries.vints@gmail.com> * Upgrade mimum Carbon version This fixes a problem with working with DateTimeImmutable instances in the cache repository. Signed-off-by: Dries Vints <dries.vints@gmail.com>
1 parent 372dcf3 commit b12feab

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"erusev/parsedown": "~1.7",
2424
"league/flysystem": "^1.0.8",
2525
"monolog/monolog": "~1.12",
26-
"nesbot/carbon": "1.25.*",
26+
"nesbot/carbon": "1.26.*",
2727
"psr/container": "~1.0",
2828
"psr/simple-cache": "^1.0",
2929
"ramsey/uuid": "^3.7",

src/Illuminate/Cache/Repository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ protected function getMinutes($duration)
552552
$duration = $this->parseDateInterval($duration);
553553

554554
if ($duration instanceof DateTimeInterface) {
555-
$duration = Carbon::now()->diffInSeconds(Carbon::createFromTimestamp($duration->getTimestamp()), false) / 60;
555+
$duration = Carbon::now()->diffInRealSeconds($duration, false) / 60;
556556
}
557557

558558
return (int) ($duration * 60) > 0 ? $duration : null;

src/Illuminate/Support/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"ext-mbstring": "*",
1919
"doctrine/inflector": "~1.1",
2020
"illuminate/contracts": "5.6.*",
21-
"nesbot/carbon": "1.25.*"
21+
"nesbot/carbon": "1.26.*"
2222
},
2323
"conflict": {
2424
"tightenco/collect": "<5.5.33"

0 commit comments

Comments
 (0)
0