From 5d300d02bd5bd62a03a2c8f196d955588cb85b54 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 5 Oct 2023 20:41:01 +0200 Subject: [PATCH] Fix broken comparison logic for years The current year was compared to seconds since 1970 instead of another year... --- src/Checks/PlausiForLegalStatus/MDPlausiForLegalStatus.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Checks/PlausiForLegalStatus/MDPlausiForLegalStatus.php b/src/Checks/PlausiForLegalStatus/MDPlausiForLegalStatus.php index 0b8da27..49f9d5c 100644 --- a/src/Checks/PlausiForLegalStatus/MDPlausiForLegalStatus.php +++ b/src/Checks/PlausiForLegalStatus/MDPlausiForLegalStatus.php @@ -49,16 +49,17 @@ final class MDPlausiForLegalStatus { private function _determineExpectedStatus():string { $currentYear = (int)date("Y"); + $deathYearOfLastCreator = (int)date("Y", $this->_death_of_last_creator); - if (!isset($this->_death_of_last_creator)) { + if (!isset($deathYearOfLastCreator)) { return 'any'; } - if ($currentYear - self::YEARS_AFTER_DEATH_TO_PUBLIC_DOMAIN > $this->_death_of_last_creator) { + if ($currentYear - self::YEARS_AFTER_DEATH_TO_PUBLIC_DOMAIN > $deathYearOfLastCreator) { return 'pd'; } - if ($currentYear - self::YEARS_AFTER_DEATH_TO_PUBLIC_DOMAIN_CERTAIN < $this->_death_of_last_creator) { + if ($currentYear - self::YEARS_AFTER_DEATH_TO_PUBLIC_DOMAIN_CERTAIN < $deathYearOfLastCreator) { return 'restricted'; }