From: Tim Düsterhus Date: Tue, 4 Apr 2023 14:44:48 +0000 (+0200) Subject: Fix incorrect migration to DateTimeImmutable X-Git-Tag: 6.0.0_Alpha_1~296 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0c63a7c26150afc0a1ed33278179639b586b2d52;p=GitHub%2FWoltLab%2FWCF.git Fix incorrect migration to DateTimeImmutable This was broken in 48aad6ed4800f20d3e12fcf7e9a351d8791cd90d. Fixes #5391 --- 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'));