summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c36
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;