Fix bug #52290 (setDate, setISODate, setTime works wrong when DateTime created from timestamp)

This commit is contained in:
Stanislav Malyshev 2011-01-30 10:18:12 +00:00
parent 7eca674e59
commit 71f3d3793d
3 changed files with 5 additions and 2 deletions

2
NEWS
View File

@ -41,6 +41,8 @@
. Fixed bug #52808 (Segfault when specifying interval as two dates). (Stas)
. Fixed bug #52738 (Can't use new properties in class extended from
DateInterval). (Stas)
. Fixed bug #52290 (setDate, setISODate, setTime works wrong when DateTime
created from timestamp). (Stas)
. Fixed bug #52063 (DateTime constructor's second argument doesn't have a
null default value). (Gustavo, Stas)

View File

@ -3090,6 +3090,7 @@ PHP_FUNCTION(date_isodate_set)
dateobj->time->y = y;
dateobj->time->m = 1;
dateobj->time->d = 1;
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
dateobj->time->have_relative = 1;

View File

@ -23,5 +23,5 @@ var_dump($dt->format('o-\WW-N | Y-m-d | H:i:s | U'));
--EXPECTF--
string(47) "2005-W52-7 | 2006-01-01 | 00:00:00 | 1136073600"
string(47) "2005-W52-1 | 2005-12-26 | 00:00:00 | 1135555200"
string(47) "2007-W40-5 | 2007-10-10 | 00:00:00 | 1191974400"
string(47) "2007-W40-5 | 2007-10-10 | 20:30:40 | 1192048240"
string(47) "2007-W41-3 | 2007-10-10 | 00:00:00 | 1191974400"
string(47) "2007-W41-3 | 2007-10-10 | 20:30:40 | 1192048240"