diff options
author | Anatol Belski <ab@php.net> | 2014-08-24 11:48:57 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-24 11:48:57 +0200 |
commit | 80a3b9ca4089f6b6d18aa700e611eff2530ebb3d (patch) | |
tree | 38065410f8d8cae990c92ea2409b6b9191e540f6 | |
parent | b2d123f985da16d8042c1a910bfd0ac572bb6997 (diff) | |
download | php-git-80a3b9ca4089f6b6d18aa700e611eff2530ebb3d.tar.gz |
bring back the logic to parse 64 bit props also in 32 bit build
-rw-r--r-- | ext/date/php_date.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 2a32f8b592..1cdf4d6348 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -39,6 +39,24 @@ static __inline __int64_t php_date_llabs( __int64_t i ) { return i >= 0 ? i : -i static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; } #endif +#ifdef PHP_WIN32 +#define DATE_I64_BUF_LEN 65 +# define DATE_I64A(i, s, len) _i64toa_s(i, s, len, 10) +# define DATE_A64I(i, s) i = _atoi64(s) +#else +#define DATE_I64_BUF_LEN 65 +# define DATE_I64A(i, s, len) \ + do { \ + int st = snprintf(s, len, "%lld", i); \ + s[st] = '\0'; \ + } while (0); +#ifdef HAVE_ATOLL +# define DATE_A64I(i, s) i = atoll(s) +#else +# define DATE_A64I(i, s) i = strtoll(s, NULL, 10) +#endif +#endif + /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1) ZEND_ARG_INFO(0, format) @@ -4112,7 +4130,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \ if (z_arg) { \ zend_string *str = zval_get_string(z_arg); \ - ZEND_ATOI((*intobj)->diff->member, str->val); \ + DATE_A64I((*intobj)->diff->member, str->val); \ STR_RELEASE(str); \ } else { \ (*intobj)->diff->member = -1LL; \ |