Bug #63615 DateTime::modify() ignores timezone [PATCH]

From: Date: Wed, 05 Dec 2012 22:32:36 +0000
Subject: Bug #63615 DateTime::modify() ignores timezone [PATCH]
Groups: php.internals 
Request: Send a blank email to internals+get-64167@lists.php.net to get a copy of this message
I looked into this, and the modify function was not setting the timezone information back to the parent dateobj. I have created a patch that does this, IF the timezone information is set on the new modified timestamp. It is attached to the bug itself, and here as well. This is, of course, assuming that date_modify() should actually modify the timezone information. If this is intended functionality, then this patch will fix it. If not, the bug should be closed as a no fix. Thanks

--- ../php-5.4.9_orig/ext/date/php_date.c 2012-11-20 23:12:20.000000000 -0600 +++ ext/date/php_date.c 2012-12-05 10:27:47.586424481 -0600 @@ -2763,6 +2763,24 @@ dateobj->time->s = 0; } } + + if(tmp_time->zone_type) { + dateobj->time->zone_type = tmp_time->zone_type; + switch (tmp_time->zone_type) { + case TIMELIB_ZONETYPE_ID: + dateobj->time->tz_info = tmp_time->tz_info; + break; + case TIMELIB_ZONETYPE_OFFSET: + dateobj->time->z = tmp_time->z; + break; + case TIMELIB_ZONETYPE_ABBR: + dateobj->time->z = tmp_time->z; + dateobj->time->dst = tmp_time->dst; + dateobj->time->tz_abbr = strdup(tmp_time->tz_abbr); + break; + } + } + timelib_time_dtor(tmp_time); timelib_update_ts(dateobj->time, NULL);
« previous php.internals (#64167) next »