From dc9463908449c589f9adedefd794ec67983c601c Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 13 Nov 2018 10:44:19 +0100 Subject: [PATCH 1/3] 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 https://github.com/briannesbitt/Carbon/issues/1503 --- src/Illuminate/Cache/Repository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/Repository.php b/src/Illuminate/Cache/Repository.php index f5dfd7cc652..98b8de9e1d3 100755 --- a/src/Illuminate/Cache/Repository.php +++ b/src/Illuminate/Cache/Repository.php @@ -552,7 +552,7 @@ protected function getMinutes($duration) $duration = $this->parseDateInterval($duration); if ($duration instanceof DateTimeInterface) { - $duration = Carbon::now()->diffInSeconds(Carbon::createFromTimestamp($duration->getTimestamp()), false) / 60; + $duration = Carbon::now()->diffInRealSeconds(Carbon::createFromTimestamp($duration->getTimestamp()), false) / 60; } return (int) ($duration * 60) > 0 ? $duration : null; From 74db18b4e0a3bc12b056abb41e348ff505d2b066 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 13 Nov 2018 10:46:16 +0100 Subject: [PATCH 2/3] Clean up diff check in cache repository We can pass the duration here directly. Signed-off-by: Dries Vints --- src/Illuminate/Cache/Repository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/Repository.php b/src/Illuminate/Cache/Repository.php index 98b8de9e1d3..01984338e18 100755 --- a/src/Illuminate/Cache/Repository.php +++ b/src/Illuminate/Cache/Repository.php @@ -552,7 +552,7 @@ protected function getMinutes($duration) $duration = $this->parseDateInterval($duration); if ($duration instanceof DateTimeInterface) { - $duration = Carbon::now()->diffInRealSeconds(Carbon::createFromTimestamp($duration->getTimestamp()), false) / 60; + $duration = Carbon::now()->diffInRealSeconds($duration, false) / 60; } return (int) ($duration * 60) > 0 ? $duration : null; From 998bd80c72ccc59ddf75a526e5cfbf819bc565d3 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 13 Nov 2018 11:15:20 +0100 Subject: [PATCH 3/3] Upgrade minimum Carbon requirement We need this for the diffInRealSeconds method. Signed-off-by: Dries Vints --- composer.json | 2 +- src/Illuminate/Support/composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f892a85e93c..dce939cf9f8 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "league/flysystem": "^1.0.8", "monolog/monolog": "~1.12", "mtdowling/cron-expression": "~1.0", - "nesbot/carbon": "^1.24.1", + "nesbot/carbon": "^1.26.0", "psr/container": "~1.0", "psr/simple-cache": "^1.0", "ramsey/uuid": "~3.0", diff --git a/src/Illuminate/Support/composer.json b/src/Illuminate/Support/composer.json index 35f3ebd2115..a98450c02ef 100644 --- a/src/Illuminate/Support/composer.json +++ b/src/Illuminate/Support/composer.json @@ -18,7 +18,7 @@ "ext-mbstring": "*", "doctrine/inflector": "~1.1", "illuminate/contracts": "5.5.*", - "nesbot/carbon": "^1.24.1" + "nesbot/carbon": "^1.26.0" }, "replace": { "tightenco/collect": "<5.5.33"