From 0c63a7c26150afc0a1ed33278179639b586b2d52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 4 Apr 2023 16:44:48 +0200 Subject: [PATCH] Fix incorrect migration to DateTimeImmutable This was broken in 48aad6ed4800f20d3e12fcf7e9a351d8791cd90d. Fixes #5391 --- wcfsetup/install/files/lib/data/user/UserProfile.class.php | 4 +--- .../lib/system/condition/UserBirthdayCondition.class.php | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/data/user/UserProfile.class.php b/wcfsetup/install/files/lib/data/user/UserProfile.class.php index 08e69c8d30..3b41ea8480 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfile.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfile.class.php @@ -836,9 +836,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject $showYear = $this->birthdayShowYear || WCF::getSession()->getPermission('admin.general.canViewPrivateUserOptions'); - $d = new \DateTimeImmutable(); - $d->setTimezone(WCF::getUser()->getTimeZone()); - $d->setDate($birthdayYear, $month, $day); + $d = new \DateTimeImmutable($this->birthday, WCF::getUser()->getTimeZone()); $dateFormat = (($showYear && $birthdayYear) ? WCF::getLanguage()->get(DateUtil::DATE_FORMAT) : \str_replace( 'Y', '', diff --git a/wcfsetup/install/files/lib/system/condition/UserBirthdayCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserBirthdayCondition.class.php index f38ec99e16..a7950135c3 100644 --- a/wcfsetup/install/files/lib/system/condition/UserBirthdayCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserBirthdayCondition.class.php @@ -89,8 +89,7 @@ HTML; return false; } - $dateTime = new \DateTimeImmutable(); - $dateTime->setTimezone(WCF::getUser()->getTimeZone()); + $dateTime = new \DateTimeImmutable('now', WCF::getUser()->getTimeZone()); $userIDs = UserBirthdayCache::getInstance()->getBirthdays($dateTime->format('n'), $dateTime->format('j')); -- 2.20.1