summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c314
1 files changed, 157 insertions, 157 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 1cdf4d6348..e8e135d83a 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -860,9 +860,9 @@ PHP_MINIT_FUNCTION(date)
REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT);
php_date_global_timezone_db = NULL;
php_date_global_timezone_db_enabled = 0;
@@ -962,7 +962,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
zval ztz;
if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz)
- && Z_TYPE(ztz) == IS_STRING && Z_STRSIZE(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
+ && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
return Z_STRVAL(ztz);
}
} else if (*DATEG(default_timezone)) {
@@ -1217,9 +1217,9 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
{
char *format;
int format_len;
- php_int_t ts;
+ zend_long ts;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 1) {
@@ -1373,10 +1373,10 @@ PHP_FUNCTION(idate)
{
char *format;
int format_len;
- php_int_t ts = 0;
+ zend_long ts = 0;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
RETURN_FALSE;
}
@@ -1394,7 +1394,7 @@ PHP_FUNCTION(idate)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token.");
RETURN_FALSE;
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1411,12 +1411,12 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
/* }}} */
/* {{{ php_parse_date: Backwards compatibility function */
-PHPAPI php_int_t php_parse_date(char *string, php_int_t *now)
+PHPAPI zend_long php_parse_date(char *string, zend_long *now)
{
timelib_time *parsed_time;
timelib_error_container *error = NULL;
int error2;
- php_int_t retval;
+ zend_long retval;
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
if (error->error_count) {
@@ -1442,14 +1442,14 @@ PHP_FUNCTION(strtotime)
char *times, *initial_ts;
int time_len, error1, error2;
struct timelib_error_container *error;
- php_int_t preset_ts = 0, ts;
+ zend_long preset_ts = 0, ts;
timelib_time *t, *now;
timelib_tzinfo *tzi;
tzi = get_timezone_info(TSRMLS_C);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "si", &times, &time_len, &preset_ts) != FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sl", &times, &time_len, &preset_ts) != FAILURE) {
/* We have an initial timestamp */
now = timelib_time_ctor();
@@ -1462,7 +1462,7 @@ PHP_FUNCTION(strtotime)
timelib_unixtime2local(now, t->sse);
timelib_time_dtor(t);
efree(initial_ts);
- } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &times, &time_len, &preset_ts) != FAILURE) {
+ } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &times, &time_len, &preset_ts) != FAILURE) {
/* We have no initial timestamp */
now = timelib_time_ctor();
now->tz_info = tzi;
@@ -1490,7 +1490,7 @@ PHP_FUNCTION(strtotime)
if (error1 || error2) {
RETURN_FALSE;
} else {
- RETURN_INT(ts);
+ RETURN_LONG(ts);
}
}
/* }}} */
@@ -1498,13 +1498,13 @@ PHP_FUNCTION(strtotime)
/* {{{ php_mktime - (gm)mktime helper */
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
{
- php_int_t hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1;
+ zend_long hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1;
timelib_time *now;
timelib_tzinfo *tzi = NULL;
- php_int_t ts, adjust_seconds = 0;
+ zend_long ts, adjust_seconds = 0;
int error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iiiiiii", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lllllll", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) {
RETURN_FALSE;
}
/* Initialize structure with current time */
@@ -1582,7 +1582,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
if (error) {
RETURN_FALSE;
} else {
- RETURN_INT(ts);
+ RETURN_LONG(ts);
}
}
/* }}} */
@@ -1607,9 +1607,9 @@ PHP_FUNCTION(gmmktime)
Returns true(1) if it is a valid date in gregorian calendar */
PHP_FUNCTION(checkdate)
{
- php_int_t m, d, y;
+ zend_long m, d, y;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &m, &d, &y) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &m, &d, &y) == FAILURE) {
RETURN_FALSE;
}
@@ -1626,7 +1626,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
{
char *format;
int format_len;
- php_int_t timestamp = 0;
+ zend_long timestamp = 0;
struct tm ta;
int max_reallocs = 5;
size_t buf_len = 256, real_len;
@@ -1635,9 +1635,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
timelib_time_offset *offset = NULL;
zend_string *buf;
- timestamp = (php_int_t) time(NULL);
+ timestamp = (zend_long) time(NULL);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &timestamp) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -1686,10 +1686,10 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
/* VS2012 crt has a bug where strftime crash with %z and %Z format when the
initial buffer is too small. See
http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code */
- buf = STR_ALLOC(buf_len, 0);
+ buf = zend_string_alloc(buf_len, 0);
while ((real_len = strftime(buf->val, buf_len, format, &ta)) == buf_len || real_len == 0) {
buf_len *= 2;
- buf = STR_REALLOC(buf, buf_len, 0);
+ buf = zend_string_realloc(buf, buf_len, 0);
if (!--max_reallocs) {
break;
}
@@ -1708,10 +1708,10 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
}
if (real_len && real_len != buf_len) {
- buf = STR_REALLOC(buf, real_len, 0);
+ buf = zend_string_realloc(buf, real_len, 0);
RETURN_STR(buf);
}
- STR_FREE(buf);
+ zend_string_free(buf);
RETURN_FALSE;
}
/* }}} */
@@ -1737,7 +1737,7 @@ PHP_FUNCTION(gmstrftime)
Return current UNIX timestamp */
PHP_FUNCTION(time)
{
- RETURN_INT((php_int_t)time(NULL));
+ RETURN_LONG((zend_long)time(NULL));
}
/* }}} */
@@ -1745,12 +1745,12 @@ PHP_FUNCTION(time)
Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */
PHP_FUNCTION(localtime)
{
- php_int_t timestamp = (php_int_t)time(NULL);
+ zend_long timestamp = (zend_long)time(NULL);
zend_bool associative = 0;
timelib_tzinfo *tzi;
timelib_time *ts;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ib", &timestamp, &associative) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", &timestamp, &associative) == FAILURE) {
RETURN_FALSE;
}
@@ -1763,25 +1763,25 @@ PHP_FUNCTION(localtime)
array_init(return_value);
if (associative) {
- add_assoc_int(return_value, "tm_sec", ts->s);
- add_assoc_int(return_value, "tm_min", ts->i);
- add_assoc_int(return_value, "tm_hour", ts->h);
- add_assoc_int(return_value, "tm_mday", ts->d);
- add_assoc_int(return_value, "tm_mon", ts->m - 1);
- add_assoc_int(return_value, "tm_year", ts->y - 1900);
- add_assoc_int(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d));
- add_assoc_int(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d));
- add_assoc_int(return_value, "tm_isdst", ts->dst);
+ add_assoc_long(return_value, "tm_sec", ts->s);
+ add_assoc_long(return_value, "tm_min", ts->i);
+ add_assoc_long(return_value, "tm_hour", ts->h);
+ add_assoc_long(return_value, "tm_mday", ts->d);
+ add_assoc_long(return_value, "tm_mon", ts->m - 1);
+ add_assoc_long(return_value, "tm_year", ts->y - 1900);
+ add_assoc_long(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "tm_isdst", ts->dst);
} else {
- add_next_index_int(return_value, ts->s);
- add_next_index_int(return_value, ts->i);
- add_next_index_int(return_value, ts->h);
- add_next_index_int(return_value, ts->d);
- add_next_index_int(return_value, ts->m - 1);
- add_next_index_int(return_value, ts->y- 1900);
- add_next_index_int(return_value, timelib_day_of_week(ts->y, ts->m, ts->d));
- add_next_index_int(return_value, timelib_day_of_year(ts->y, ts->m, ts->d));
- add_next_index_int(return_value, ts->dst);
+ add_next_index_long(return_value, ts->s);
+ add_next_index_long(return_value, ts->i);
+ add_next_index_long(return_value, ts->h);
+ add_next_index_long(return_value, ts->d);
+ add_next_index_long(return_value, ts->m - 1);
+ add_next_index_long(return_value, ts->y- 1900);
+ add_next_index_long(return_value, timelib_day_of_week(ts->y, ts->m, ts->d));
+ add_next_index_long(return_value, timelib_day_of_year(ts->y, ts->m, ts->d));
+ add_next_index_long(return_value, ts->dst);
}
timelib_time_dtor(ts);
@@ -1792,11 +1792,11 @@ PHP_FUNCTION(localtime)
Get date/time information */
PHP_FUNCTION(getdate)
{
- php_int_t timestamp = (php_int_t)time(NULL);
+ zend_long timestamp = (zend_long)time(NULL);
timelib_tzinfo *tzi;
timelib_time *ts;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &timestamp) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -1808,17 +1808,17 @@ PHP_FUNCTION(getdate)
array_init(return_value);
- add_assoc_int(return_value, "seconds", ts->s);
- add_assoc_int(return_value, "minutes", ts->i);
- add_assoc_int(return_value, "hours", ts->h);
- add_assoc_int(return_value, "mday", ts->d);
- add_assoc_int(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d));
- add_assoc_int(return_value, "mon", ts->m);
- add_assoc_int(return_value, "year", ts->y);
- add_assoc_int(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "seconds", ts->s);
+ add_assoc_long(return_value, "minutes", ts->i);
+ add_assoc_long(return_value, "hours", ts->h);
+ add_assoc_long(return_value, "mday", ts->d);
+ add_assoc_long(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "mon", ts->m);
+ add_assoc_long(return_value, "year", ts->y);
+ add_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d));
add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d));
add_assoc_string(return_value, "month", mon_full_names[ts->m - 1]);
- add_index_int(return_value, 0, timestamp);
+ add_index_long(return_value, 0, timestamp);
timelib_time_dtor(ts);
}
@@ -1925,7 +1925,7 @@ static zval *date_period_it_current_data(zend_object_iterator *iter TSRMLS_DC)
static void date_period_it_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
{
date_period_it *iterator = (date_period_it *)iter;
- ZVAL_INT(key, iterator->current_index);
+ ZVAL_LONG(key, iterator->current_index);
}
/* }}} */
@@ -2049,7 +2049,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */
date_object_handlers_timezone.get_gc = date_object_get_gc_timezone;
#define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \
- zend_declare_class_constant_int(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC);
+ zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC);
REGISTER_TIMEZONE_CLASS_CONST_STRING("AFRICA", PHP_DATE_TIMEZONE_GROUP_AFRICA);
REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA);
@@ -2096,7 +2096,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */
date_object_handlers_period.write_property = date_period_write_property;
#define REGISTER_PERIOD_CLASS_CONST_STRING(const_name, value) \
- zend_declare_class_constant_int(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC);
+ zend_declare_class_constant_long(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC);
REGISTER_PERIOD_CLASS_CONST_STRING("EXCLUDE_START_DATE", PHP_DATE_PERIOD_EXCLUDE_START_DATE);
} /* }}} */
@@ -2203,7 +2203,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */
/* then we add the timezone name (or similar) */
if (dateobj->time->is_localtime) {
- ZVAL_INT(&zv, dateobj->time->zone_type);
+ ZVAL_LONG(&zv, dateobj->time->zone_type);
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
switch (dateobj->time->zone_type) {
@@ -2211,7 +2211,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */
ZVAL_STRING(&zv, dateobj->time->tz_info->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
- zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0);
+ zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
timelib_sll utc_offset = dateobj->time->z;
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
@@ -2296,7 +2296,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /*
return props;
}
- ZVAL_INT(&zv, tzobj->type);
+ ZVAL_LONG(&zv, tzobj->type);
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
switch (tzobj->type) {
@@ -2304,7 +2304,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /*
ZVAL_STRING(&zv, tzobj->tzi.tz->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
- zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0);
+ zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
tzobj->tzi.utc_offset > 0 ? '-' : '+',
@@ -2377,7 +2377,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) /*
}
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
- ZVAL_INT(&zv, (php_int_t)intervalobj->diff->f); \
+ ZVAL_LONG(&zv, (zend_long)intervalobj->diff->f); \
zend_hash_str_update(props, n, sizeof(n)-1, &zv);
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
@@ -2765,13 +2765,13 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
if (z_timezone) {
convert_to_string(z_timezone);
- switch (Z_IVAL_P(z_timezone_type)) {
+ switch (Z_LVAL_P(z_timezone_type)) {
case TIMELIB_ZONETYPE_OFFSET:
case TIMELIB_ZONETYPE_ABBR: {
- char *tmp = emalloc(Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2);
+ char *tmp = emalloc(Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2);
int ret;
- snprintf(tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone));
- ret = php_date_initialize(*dateobj, tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
+ snprintf(tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone));
+ ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
efree(tmp);
return 1 == ret;
}
@@ -2791,7 +2791,7 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
- ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRSIZE_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC);
+ ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRLEN_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp_obj);
return 1 == ret;
}
@@ -2870,14 +2870,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) /
int i;
zval element;
- add_assoc_int(z, "warning_count", error->warning_count);
+ add_assoc_long(z, "warning_count", error->warning_count);
array_init(&element);
for (i = 0; i < error->warning_count; i++) {
add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message);
}
add_assoc_zval(z, "warnings", &element);
- add_assoc_int(z, "error_count", error->error_count);
+ add_assoc_long(z, "error_count", error->error_count);
array_init(&element);
for (i = 0; i < error->error_count; i++) {
add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message);
@@ -2908,7 +2908,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
if (parsed_time->elem == -99999) { \
add_assoc_bool(return_value, #name, 0); \
} else { \
- add_assoc_int(return_value, #name, parsed_time->elem); \
+ add_assoc_long(return_value, #name, parsed_time->elem); \
}
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m);
@@ -2953,17 +2953,17 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
}
if (parsed_time->have_relative) {
array_init(&element);
- add_assoc_int(&element, "year", parsed_time->relative.y);
- add_assoc_int(&element, "month", parsed_time->relative.m);
- add_assoc_int(&element, "day", parsed_time->relative.d);
- add_assoc_int(&element, "hour", parsed_time->relative.h);
- add_assoc_int(&element, "minute", parsed_time->relative.i);
- add_assoc_int(&element, "second", parsed_time->relative.s);
+ add_assoc_long(&element, "year", parsed_time->relative.y);
+ add_assoc_long(&element, "month", parsed_time->relative.m);
+ add_assoc_long(&element, "day", parsed_time->relative.d);
+ add_assoc_long(&element, "hour", parsed_time->relative.h);
+ add_assoc_long(&element, "minute", parsed_time->relative.i);
+ add_assoc_long(&element, "second", parsed_time->relative.s);
if (parsed_time->relative.have_weekday_relative) {
- add_assoc_int(&element, "weekday", parsed_time->relative.weekday);
+ add_assoc_long(&element, "weekday", parsed_time->relative.weekday);
}
if (parsed_time->relative.have_special_relative && (parsed_time->relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) {
- add_assoc_int(&element, "weekdays", parsed_time->relative.special.amount);
+ add_assoc_long(&element, "weekdays", parsed_time->relative.special.amount);
}
if (parsed_time->relative.first_last_day_of) {
add_assoc_bool(&element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1);
@@ -3360,24 +3360,24 @@ PHP_FUNCTION(date_offset_get)
switch (dateobj->time->zone_type) {
case TIMELIB_ZONETYPE_ID:
offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info);
- RETVAL_INT(offset->offset);
+ RETVAL_LONG(offset->offset);
timelib_time_offset_dtor(offset);
break;
case TIMELIB_ZONETYPE_OFFSET:
- RETVAL_INT(dateobj->time->z * -60);
+ RETVAL_LONG(dateobj->time->z * -60);
break;
case TIMELIB_ZONETYPE_ABBR:
- RETVAL_INT((dateobj->time->z - (60 * dateobj->time->dst)) * -60);
+ RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60);
break;
}
return;
} else {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
}
/* }}} */
-static void php_date_time_set(zval *object, php_int_t h, php_int_t i, php_int_t s, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long s, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3395,9 +3395,9 @@ static void php_date_time_set(zval *object, php_int_t h, php_int_t i, php_int_t
PHP_FUNCTION(date_time_set)
{
zval *object;
- php_int_t h, i, s = 0;
+ zend_long h, i, s = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &h, &i, &s) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
@@ -3412,9 +3412,9 @@ PHP_FUNCTION(date_time_set)
PHP_METHOD(DateTimeImmutable, setTime)
{
zval *object, new_object;
- php_int_t h, i, s = 0;
+ zend_long h, i, s = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &h, &i, &s) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
@@ -3425,7 +3425,7 @@ PHP_METHOD(DateTimeImmutable, setTime)
}
/* }}} */
-static void php_date_date_set(zval *object, php_int_t y, php_int_t m, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_date_set(zval *object, zend_long y, zend_long m, zend_long d, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3443,9 +3443,9 @@ static void php_date_date_set(zval *object, php_int_t y, php_int_t m, php_int_t
PHP_FUNCTION(date_date_set)
{
zval *object;
- php_int_t y, m, d;
+ zend_long y, m, d;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_date, &y, &m, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3460,9 +3460,9 @@ PHP_FUNCTION(date_date_set)
PHP_METHOD(DateTimeImmutable, setDate)
{
zval *object, new_object;
- php_int_t y, m, d;
+ zend_long y, m, d;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_immutable, &y, &m, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_immutable, &y, &m, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3473,7 +3473,7 @@ PHP_METHOD(DateTimeImmutable, setDate)
}
/* }}} */
-static void php_date_isodate_set(zval *object, php_int_t y, php_int_t w, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_isodate_set(zval *object, zend_long y, zend_long w, zend_long d, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3495,9 +3495,9 @@ static void php_date_isodate_set(zval *object, php_int_t y, php_int_t w, php_int
PHP_FUNCTION(date_isodate_set)
{
zval *object;
- php_int_t y, w, d = 1;
+ zend_long y, w, d = 1;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &y, &w, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3512,9 +3512,9 @@ PHP_FUNCTION(date_isodate_set)
PHP_METHOD(DateTimeImmutable, setISODate)
{
zval *object, new_object;
- php_int_t y, w, d = 1;
+ zend_long y, w, d = 1;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &y, &w, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &y, &w, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3525,7 +3525,7 @@ PHP_METHOD(DateTimeImmutable, setISODate)
}
/* }}} */
-static void php_date_timestamp_set(zval *object, php_int_t timestamp, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_timestamp_set(zval *object, zend_long timestamp, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3541,9 +3541,9 @@ static void php_date_timestamp_set(zval *object, php_int_t timestamp, zval *retu
PHP_FUNCTION(date_timestamp_set)
{
zval *object;
- php_int_t timestamp;
+ zend_long timestamp;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_date, &timestamp) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_date, &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -3558,9 +3558,9 @@ PHP_FUNCTION(date_timestamp_set)
PHP_METHOD(DateTimeImmutable, setTimestamp)
{
zval *object, new_object;
- php_int_t timestamp;
+ zend_long timestamp;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_immutable, &timestamp) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_immutable, &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -3578,7 +3578,7 @@ PHP_FUNCTION(date_timestamp_get)
{
zval *object;
php_date_obj *dateobj;
- php_int_t timestamp;
+ zend_long timestamp;
int error;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
@@ -3592,7 +3592,7 @@ PHP_FUNCTION(date_timestamp_get)
if (error) {
RETURN_FALSE;
} else {
- RETVAL_INT(timestamp);
+ RETVAL_LONG(timestamp);
}
}
/* }}} */
@@ -3605,9 +3605,9 @@ PHP_FUNCTION(date_diff)
zval *object1, *object2;
php_date_obj *dateobj1, *dateobj2;
php_interval_obj *interval;
- php_int_t absolute = 0;
+ zend_long absolute = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|i", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
RETURN_FALSE;
}
dateobj1 = Z_PHPDATE_P(object1);
@@ -3756,7 +3756,7 @@ PHP_FUNCTION(timezone_name_get)
RETURN_STRING(tzobj->tzi.tz->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
- zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0);
+ zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
timelib_sll utc_offset = tzobj->tzi.utc_offset;
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
@@ -3782,10 +3782,10 @@ PHP_FUNCTION(timezone_name_from_abbr)
char *abbr;
char *tzid;
int abbr_len;
- php_int_t gmtoffset = -1;
- php_int_t isdst = -1;
+ zend_long gmtoffset = -1;
+ zend_long isdst = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) {
RETURN_FALSE;
}
tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst);
@@ -3819,14 +3819,14 @@ PHP_FUNCTION(timezone_offset_get)
switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID:
offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz);
- RETVAL_INT(offset->offset);
+ RETVAL_LONG(offset->offset);
timelib_time_offset_dtor(offset);
break;
case TIMELIB_ZONETYPE_OFFSET:
- RETURN_INT(tzobj->tzi.utc_offset * -60);
+ RETURN_LONG(tzobj->tzi.utc_offset * -60);
break;
case TIMELIB_ZONETYPE_ABBR:
- RETURN_INT((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
+ RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
break;
}
}
@@ -3840,9 +3840,9 @@ PHP_FUNCTION(timezone_transitions_get)
zval *object, element;
php_timezone_obj *tzobj;
unsigned int i, begin = 0, found;
- php_int_t timestamp_begin = PHP_INT_MIN, timestamp_end = PHP_INT_MAX;
+ zend_long timestamp_begin = PHP_INT_MIN, timestamp_end = PHP_INT_MAX;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ii", &object, date_ce_timezone, &timestamp_begin, &timestamp_end) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, &timestamp_begin, &timestamp_end) == FAILURE) {
RETURN_FALSE;
}
tzobj = Z_PHPTIMEZONE_P(object);
@@ -3853,18 +3853,18 @@ PHP_FUNCTION(timezone_transitions_get)
#define add_nominal() \
array_init(&element); \
- add_assoc_int(&element, "ts", timestamp_begin); \
+ add_assoc_long(&element, "ts", timestamp_begin); \
add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC)); \
- add_assoc_int(&element, "offset", tzobj->tzi.tz->type[0].offset); \
+ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \
add_next_index_zval(return_value, &element);
#define add(i,ts) \
array_init(&element); \
- add_assoc_int(&element, "ts", ts); \
+ add_assoc_long(&element, "ts", ts); \
add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC)); \
- add_assoc_int(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
+ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \
add_next_index_zval(return_value, &element);
@@ -4023,7 +4023,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
retval = rv;
if (value != -99999) {
- ZVAL_INT(retval, value);
+ ZVAL_LONG(retval, value);
} else {
ZVAL_FALSE(retval);
}
@@ -4062,7 +4062,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
#define SET_VALUE_FROM_STRUCT(n,m) \
if (strcmp(Z_STRVAL_P(member), m) == 0) { \
- obj->diff->n = zval_get_int(value); \
+ obj->diff->n = zval_get_long(value); \
break; \
}
@@ -4119,7 +4119,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
do { \
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg) { \
- (*intobj)->diff->member = (itype)zval_get_int(z_arg); \
+ (*intobj)->diff->member = (itype)zval_get_long(z_arg); \
} else { \
(*intobj)->diff->member = (itype)def; \
} \
@@ -4131,7 +4131,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
if (z_arg) { \
zend_string *str = zval_get_string(z_arg); \
DATE_A64I((*intobj)->diff->member, str->val); \
- STR_RELEASE(str); \
+ zend_string_release(str); \
} else { \
(*intobj)->diff->member = -1LL; \
} \
@@ -4248,8 +4248,8 @@ static zend_string *date_interval_format(char *format, int format_len, timelib_r
case 'I': length = slprintf(buffer, 32, "%02d", (int) t->i); break;
case 'i': length = slprintf(buffer, 32, "%d", (int) t->i); break;
- case 'S': length = slprintf(buffer, 32, "%02" ZEND_INT_FMT_SPEC, (php_int_t) t->s); break;
- case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (php_int_t) t->s); break;
+ case 'S': length = slprintf(buffer, 32, "%02" ZEND_INT_FMT_SPEC, (zend_long) t->s); break;
+ case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (zend_long) t->s); break;
case 'a': {
if ((int) t->days != -99999) {
@@ -4301,7 +4301,7 @@ PHP_FUNCTION(date_interval_format)
}
/* }}} */
-static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, php_int_t *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */
+static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, zend_long *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */
{
timelib_time *b = NULL, *e = NULL;
timelib_rel_time *p = NULL;
@@ -4334,16 +4334,16 @@ PHP_METHOD(DatePeriod, __construct)
php_date_obj *dateobj;
php_interval_obj *intobj;
zval *start, *end = NULL, *interval;
- php_int_t recurrences = 0, options = 0;
+ zend_long recurrences = 0, options = 0;
char *isostr = NULL;
int isostr_len = 0;
timelib_time *clone;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOi|i", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|i", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &isostr, &isostr_len, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &isostr, &isostr_len, &options) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments.");
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
@@ -4413,7 +4413,7 @@ PHP_METHOD(DatePeriod, __construct)
}
/* }}} */
-static int check_id_allowed(char *id, php_int_t what) /* {{{ */
+static int check_id_allowed(char *id, zend_long what) /* {{{ */
{
if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA && strncasecmp(id, "America/", 8) == 0) return 1;
@@ -4437,11 +4437,11 @@ PHP_FUNCTION(timezone_identifiers_list)
const timelib_tzdb *tzdb;
const timelib_tzdb_index_entry *table;
int i, item_count;
- php_int_t what = PHP_DATE_TIMEZONE_GROUP_ALL;
+ zend_long what = PHP_DATE_TIMEZONE_GROUP_ALL;
char *option = NULL;
int option_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|is", &what, &option, &option_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &what, &option, &option_len) == FAILURE) {
RETURN_FALSE;
}
@@ -4496,7 +4496,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
do {
array_init(&element);
add_assoc_bool(&element, "dst", entry->type);
- add_assoc_int(&element, "offset", entry->gmtoffset);
+ add_assoc_long(&element, "offset", entry->gmtoffset);
if (entry->full_tz_name) {
add_assoc_string(&element, "timezone_id", entry->full_tz_name);
} else {
@@ -4558,13 +4558,13 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
double latitude = 0.0, longitude = 0.0, zenith = 0.0, gmt_offset = 0, altitude;
double h_rise, h_set, N;
timelib_sll rise, set, transit;
- php_int_t time, retformat = 0;
+ zend_long time, retformat = 0;
int rs;
timelib_time *t;
timelib_tzinfo *tzi;
zend_string *retstr;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|idddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
RETURN_FALSE;
}
@@ -4617,7 +4617,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
}
if (retformat == SUNFUNCS_RET_TIMESTAMP) {
- RETURN_INT(calc_sunset ? set : rise);
+ RETURN_LONG(calc_sunset ? set : rise);
}
N = (calc_sunset ? h_set : h_rise) + gmt_offset;
@@ -4657,7 +4657,7 @@ PHP_FUNCTION(date_sunset)
Returns an array with information about sun set/rise and twilight begin/end */
PHP_FUNCTION(date_sun_info)
{
- php_int_t time;
+ zend_long time;
double latitude, longitude;
timelib_time *t, *t2;
timelib_tzinfo *tzi;
@@ -4666,7 +4666,7 @@ PHP_FUNCTION(date_sun_info)
int dummy;
double ddummy;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "idd", &time, &latitude, &longitude) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) {
RETURN_FALSE;
}
/* Initialize time struct */
@@ -4693,12 +4693,12 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "sunrise", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "sunrise", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "sunset", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "sunset", timelib_date_to_int(t2, &dummy));
}
t2->sse = transit;
- add_assoc_int(return_value, "transit", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "transit", timelib_date_to_int(t2, &dummy));
/* Get civil twilight */
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit);
@@ -4713,9 +4713,9 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy));
}
/* Get nautical twilight */
@@ -4731,9 +4731,9 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy));
}
/* Get astronomical twilight */
@@ -4749,9 +4749,9 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy));
}
timelib_time_dtor(t);
timelib_time_dtor(t2);
@@ -4821,7 +4821,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC) /* {
zend_hash_str_update(props, "interval", sizeof("interval")-1, &zv);
/* converted to larger type (int->long); must check when unserializing */
- ZVAL_INT(&zv, (long) period_obj->recurrences);
+ ZVAL_LONG(&zv, (long) period_obj->recurrences);
zend_hash_str_update(props, "recurrences", sizeof("recurrences")-1, &zv);
ZVAL_BOOL(&zv, period_obj->include_start_date);
@@ -4891,8 +4891,8 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
ht_entry = zend_hash_str_find(myht, "recurrences", sizeof("recurrences")-1);
if (ht_entry &&
- Z_TYPE_P(ht_entry) == IS_INT && Z_IVAL_P(ht_entry) >= 0 && Z_IVAL_P(ht_entry) <= INT_MAX) {
- period_obj->recurrences = Z_IVAL_P(ht_entry);
+ Z_TYPE_P(ht_entry) == IS_LONG && Z_LVAL_P(ht_entry) >= 0 && Z_LVAL_P(ht_entry) <= INT_MAX) {
+ period_obj->recurrences = Z_LVAL_P(ht_entry);
} else {
return 0;
}