summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorDerick Rethans <github@derickrethans.nl>2014-01-26 14:02:37 +0100
committerDerick Rethans <github@derickrethans.nl>2014-01-26 14:02:37 +0100
commit7399386a2094ccce9b5deb0c035ff6ac2aa7eb8b (patch)
tree6bbccc8335fa1fe2d7103d2d2a8ddbaa6925c292 /ext/date/php_date.c
parentce1e1bb5d83bd1a94f50b24ba0b884e314264fe6 (diff)
parent251b914afa66a6ae575e16ae4ab2faf39655edba (diff)
downloadphp-git-7399386a2094ccce9b5deb0c035ff6ac2aa7eb8b.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index c069e0ccae..0e21baffa6 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -3284,11 +3284,18 @@ static void php_date_timezone_set(zval *object, zval *timezone_object, zval *ret
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
- if (tzobj->type != TIMELIB_ZONETYPE_ID) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now");
- return;
+
+ switch (tzobj->type) {
+ case TIMELIB_ZONETYPE_OFFSET:
+ timelib_set_timezone_from_offset(dateobj->time, tzobj->tzi.utc_offset);
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ timelib_set_timezone_from_abbr(dateobj->time, tzobj->tzi.z);
+ break;
+ case TIMELIB_ZONETYPE_ID:
+ timelib_set_timezone(dateobj->time, tzobj->tzi.tz);
+ break;
}
- timelib_set_timezone(dateobj->time, tzobj->tzi.tz);
timelib_unixtime2local(dateobj->time, dateobj->time->sse);
}