com php-src: Merge remote-tracking branch 'origin/master' into str_size_and_int64: ext/date/lib/timelib.h ex t/date/php_date.c

From: Date: Mon, 10 Feb 2014 11:52:57 +0000
Subject: com php-src: Merge remote-tracking branch 'origin/master' into str_size_and_int64: ext/date/lib/timelib.h ex t/date/php_date.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75951@lists.php.net to get a copy of this message
Commit: d7a5bd11e5e87fcaedb969cf6d3acdc4d4383775 Author: Anatol Belski <ab@php.net> Mon, 10 Feb 2014 12:52:57 +0100 Parents: e7719f949a4791c409aae6be8a4be371d9d07e76 a30ebbdb18edbae3842e1b1c9685261b16340041 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d7a5bd11e5e87fcaedb969cf6d3acdc4d4383775 Log: Merge remote-tracking branch 'origin/master' into str_size_and_int64 Conflicts: ext/date/php_date.c Changed paths: MM ext/date/lib/timelib.h MM ext/date/php_date.c Diff: diff --cc ext/date/php_date.c index e6b7aed,a61d9db..ebdb9c1 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@@ -3633,20 -3650,16 +3637,16 @@@ static int timezone_initialize(php_time PHP_FUNCTION(timezone_open) { char *tz; - php_size_t tz_len; - timelib_tzinfo *tzi = NULL; - int tz_len; ++ php_size_t tz_len; php_timezone_obj *tzobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &tz, &tz_len) == FAILURE) { RETURN_FALSE; } - if (SUCCESS != timezone_initialize(&tzi, tz TSRMLS_CC)) { + tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC); + if (SUCCESS != timezone_initialize(tzobj, tz TSRMLS_CC)) { RETURN_FALSE; } - tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC); - tzobj->type = TIMELIB_ZONETYPE_ID; - tzobj->tzi.tz = tzi; - tzobj->initialized = 1; } /* }}} */ @@@ -3656,19 -3669,14 +3656,14 @@@ PHP_METHOD(DateTimeZone, __construct) { char *tz; - int tz_len; + php_size_t tz_len; - timelib_tzinfo *tzi = NULL; php_timezone_obj *tzobj; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &tz, &tz_len)) { - if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) { - tzobj = zend_object_store_get_object(getThis() TSRMLS_CC); - tzobj->type = TIMELIB_ZONETYPE_ID; - tzobj->tzi.tz = tzi; - tzobj->initialized = 1; - } else { + tzobj = zend_object_store_get_object(getThis() TSRMLS_CC); + if (FAILURE == timezone_initialize(tzobj, tz TSRMLS_CC)) { ZVAL_NULL(getThis()); } } @@@ -3683,36 -3691,9 +3678,9 @@@ static int php_date_timezone_initialize if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) { if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) { - convert_to_long(*z_timezone_type); + convert_to_int(*z_timezone_type); - switch (Z_IVAL_PP(z_timezone_type)) { - case TIMELIB_ZONETYPE_OFFSET: { - char *offset, *offset_start; - - offset = emalloc(sizeof(char) * (Z_STRSIZE_PP(z_timezone) + 1)); - memmove(offset, Z_STRVAL_PP(z_timezone), Z_STRSIZE_PP(z_timezone)+1); - offset_start = offset; - - ++offset; - if(*offset_start == '+'){ - (*tzobj)->tzi.utc_offset = -1 * timelib_parse_tz_cor(&offset); - } else { - (*tzobj)->tzi.utc_offset = timelib_parse_tz_cor(&offset); - } - efree(offset_start); - (*tzobj)->type = TIMELIB_ZONETYPE_OFFSET; - (*tzobj)->initialized = 1; - return SUCCESS; - break; - } - case TIMELIB_ZONETYPE_ABBR: - case TIMELIB_ZONETYPE_ID: - if (SUCCESS == timezone_initialize(&tzi, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) { - (*tzobj)->type = TIMELIB_ZONETYPE_ID; - (*tzobj)->tzi.tz = tzi; - (*tzobj)->initialized = 1; - return SUCCESS; - } + if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) { + return SUCCESS; } } }

« previous php.cvs (#75951) next »