Skip to content

Commit

Permalink
Fix bug #52290 (setDate, setISODate, setTime works wrong when DateTim…
Browse files Browse the repository at this point in the history
…e created from timestamp)
  • Loading branch information
smalyshev committed Jan 30, 2011
1 parent 5bb0a44 commit 1e91069
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,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;

Expand Down
4 changes: 2 additions & 2 deletions ext/date/tests/bug52290.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 1e91069

Please sign in to comment.