Fix incorrect migration to DateTimeImmutable
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 4 Apr 2023 14:44:48 +0000 (16:44 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 4 Apr 2023 14:44:48 +0000 (16:44 +0200)
This was broken in 48aad6ed4800f20d3e12fcf7e9a351d8791cd90d.

Fixes #5391

wcfsetup/install/files/lib/data/user/UserProfile.class.php
wcfsetup/install/files/lib/system/condition/UserBirthdayCondition.class.php

index 08e69c8d303edec5fb047fd1641260e9fc535cc4..3b41ea8480649da7e8b069f3923122910f13c52b 100644 (file)
@@ -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',
             '',
index f38ec99e165ab0c68c7686e5af330e5ea5269867..a7950135c30009d76e67eff79afed2afde53799e 100644 (file)
@@ -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'));