Fix broken comparison logic for years

The current year was compared to seconds since 1970 instead of another
year...
This commit is contained in:
Joshua Ramon Enslin 2023-10-05 20:41:01 +02:00
parent fbcf66d906
commit 5d300d02bd
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -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';
}