From 2b708363b55739b32ae59ccccc62a7ad2fb1b462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Wed, 6 Dec 2023 17:47:00 +0100 Subject: [PATCH] Fix: Do not pass null to function that expects DateTime or string (#869) --- eol.php | 2 +- include/branches.inc | 5 ++--- supported-versions.php | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eol.php b/eol.php index 4025663660..6685606aa2 100644 --- a/eol.php +++ b/eol.php @@ -48,7 +48,7 @@ $branches): ?> $detail): ?> - + diff --git a/include/branches.inc b/include/branches.inc index 44d6f987a2..f31ab8567b 100644 --- a/include/branches.inc +++ b/include/branches.inc @@ -43,11 +43,10 @@ $BRANCHES = [ * page. (Currently 28 days.) */ $KEEP_EOL = new DateInterval('P28D'); -function format_interval($from, $to) { +function format_interval($from, DateTime $to) { try { $from_obj = $from instanceof DateTime ? $from : new DateTime($from); - $to_obj = $to instanceof DateTime ? $to : new DateTime($to); - $diff = $to_obj->diff($from_obj); + $diff = $to->diff($from_obj); $times = []; if ($diff->y) { diff --git a/supported-versions.php b/supported-versions.php index 36bb92751d..a6c6ffe9e7 100644 --- a/supported-versions.php +++ b/supported-versions.php @@ -54,6 +54,7 @@ $initial = get_branch_release_date($branch); $until = get_branch_bug_eol_date($branch); $eol = get_branch_security_eol_date($branch); + $now = new DateTime('now'); ?> @@ -63,11 +64,11 @@ format('j M Y')) ?> - + format('j M Y')) ?> - + format('j M Y')) ?> - +