diff options
author | Anatol Belski <ab@php.net> | 2014-12-13 19:43:45 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-12-13 19:43:45 +0100 |
commit | bb66f385d09e7e55390e9f57fcbca08f6b43ff91 (patch) | |
tree | 54defb44e55c1ebc0afa15aa60758d87a4b9ce3b /Zend/zend_API.c | |
parent | dfb18b1188492efa48ade07029172c5535f65f93 (diff) | |
parent | 0ea0b591d79ae0ee18d33533a5c701330836ff6b (diff) | |
download | php-git-bb66f385d09e7e55390e9f57fcbca08f6b43ff91.tar.gz |
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (37 commits)
NEWS
NEWS
Fix bug #68601 buffer read overflow in gd_gif_in.c
Fixed compilation warnings
Removed unnecessary checks
pcntl_signal_dispatch: Speed up by preventing system calls when unnecessary
Merged PR #911.
Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before.
Updated NEWS
Updated NEWS
Updated NEWS
Fix bug #68532: convert.base64-encode omits padding bytes
Updated NEWS
Updated NEWS
Updated NEWS
Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor)
Updated NEWS
Updated NEWS
Fix MySQLi tests
Fixed gd test
...
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 369852ffbe..788da61474 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -404,14 +404,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { - if (c == 'L') { - if (d > ZEND_LONG_MAX) { - *p = ZEND_LONG_MAX; - break; - } else if (d < ZEND_LONG_MIN) { - *p = ZEND_LONG_MIN; - break; + if (zend_isnan(d)) { + return "long"; + } + if (!ZEND_DOUBLE_FITS_LONG(d)) { + if (c == 'L') { + *p = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return "long"; } + break; } *p = zend_dval_to_lval(d); @@ -420,14 +422,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons break; case IS_DOUBLE: - if (c == 'L') { - if (Z_DVAL_P(arg) > ZEND_LONG_MAX) { - *p = ZEND_LONG_MAX; - break; - } else if (Z_DVAL_P(arg) < ZEND_LONG_MIN) { - *p = ZEND_LONG_MIN; - break; + if (zend_isnan(Z_DVAL_P(arg))) { + return "long"; + } + if (!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg))) { + if (c == 'L') { + *p = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return "long"; } + break; } case IS_NULL: case IS_FALSE: @@ -1127,7 +1131,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC) } /* }}} */ -static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS_DC) /* {{{ */ +static int zval_update_class_constant(zval *pp, int is_static, uint32_t offset TSRMLS_DC) /* {{{ */ { ZVAL_DEREF(pp); if (Z_CONSTANT_P(pp)) { @@ -2195,7 +2199,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio internal_function->arg_info = (zend_internal_arg_info*)ptr->arg_info+1; internal_function->num_args = ptr->num_args; /* Currently you cannot denote that the function can accept less arguments than num_args */ - if (info->required_num_args == -1) { + if (info->required_num_args == (zend_uintptr_t)-1) { internal_function->required_num_args = ptr->num_args; } else { internal_function->required_num_args = info->required_num_args; |