Skip to content

Commit 1e91069

Browse files
committed
Fix bug #52290 (setDate, setISODate, setTime works wrong when DateTime created from timestamp)
1 parent 5bb0a44 commit 1e91069

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ext/date/php_date.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,6 +3085,7 @@ PHP_FUNCTION(date_isodate_set)
30853085
dateobj->time->y = y;
30863086
dateobj->time->m = 1;
30873087
dateobj->time->d = 1;
3088+
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
30883089
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
30893090
dateobj->time->have_relative = 1;
30903091

ext/date/tests/bug52290.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ var_dump($dt->format('o-\WW-N | Y-m-d | H:i:s | U'));
2323
--EXPECTF--
2424
string(47) "2005-W52-7 | 2006-01-01 | 00:00:00 | 1136073600"
2525
string(47) "2005-W52-1 | 2005-12-26 | 00:00:00 | 1135555200"
26-
string(47) "2007-W40-5 | 2007-10-10 | 00:00:00 | 1191974400"
27-
string(47) "2007-W40-5 | 2007-10-10 | 20:30:40 | 1192048240"
26+
string(47) "2007-W41-3 | 2007-10-10 | 00:00:00 | 1191974400"
27+
string(47) "2007-W41-3 | 2007-10-10 | 20:30:40 | 1192048240"

0 commit comments

Comments
 (0)