summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2014-01-28 15:23:54 +0200
committerAndrey Hristov <andrey@php.net>2014-01-28 15:23:54 +0200
commiteafe070f86eb53271e7c95572f371d9abcadf252 (patch)
tree0d7d68b25b023fc7ff7c5ed6faec3ed9308daf0b /ext/date/php_date.c
parentd3faae03ec6271873a25dd7e329cc2bdc6af7324 (diff)
parente9b4bca5a00d475c4176ce24a5203d42607642e8 (diff)
downloadphp-git-eafe070f86eb53271e7c95572f371d9abcadf252.tar.gz
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
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 1655057212..c0566334db 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2992,11 +2992,18 @@ PHP_FUNCTION(date_timezone_set)
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);
RETURN_ZVAL(object, 1, 0);