com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/date/lib/timelib.h ext/date/php_date.c ext/date/php_date.h
| From: | Derick Rethans | Date: | Sun, 26 Jan 2014 13:02:37 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/date/lib/timelib.h ext/date/php_date.c ext/date/php_date.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75796@lists.php.net to get a copy of this message | ||
Commit: 7399386a2094ccce9b5deb0c035ff6ac2aa7eb8b
Author: Derick Rethans <github@derickrethans.nl> Sun, 26 Jan 2014 14:02:37 +0100
Parents: ce1e1bb5d83bd1a94f50b24ba0b884e314264fe6 251b914afa66a6ae575e16ae4ab2faf39655edba
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7399386a2094ccce9b5deb0c035ff6ac2aa7eb8b
Log:
Merge branch 'PHP-5.4' into PHP-5.5
Changed paths:
MM ext/date/lib/timelib.h
MM ext/date/php_date.c
MM ext/date/php_date.h
Diff:
diff --cc ext/date/php_date.c
index c069e0c,c056633..0e21baf
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@@ -3284,27 -2989,22 +3284,34 @@@ static void php_date_timezone_set(zval
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);
+}
+
+/* {{{ proto DateTime date_timezone_set(DateTime object, DateTimeZone object)
+ Sets the timezone for the DateTime object.
+*/
+PHP_FUNCTION(date_timezone_set)
+{
+ zval *object;
+ zval *timezone_object;
+
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO",
&object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ php_date_timezone_set(object, timezone_object, return_value TSRMLS_CC);
RETURN_ZVAL(object, 1, 0);
}
diff --cc ext/date/php_date.h
index d4204eb,4ce730b..d7343e0
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@@ -137,16 -122,10 +137,11 @@@ struct _php_timezone_obj
int initialized;
int type;
union {
- timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */
- timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
- struct /* TIMELIB_ZONETYPE_ABBR */
- {
- timelib_sll utc_offset;
- char *abbr;
- int dst;
- } z;
+ timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID */
+ timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
+ timelib_abbr_info z; /* TIMELIB_ZONETYPE_ABBR */
} tzi;
+ HashTable *props;
};
struct _php_interval_obj {