--- embedaddon/php/ext/standard/array.c 2013/07/22 01:32:04 1.1.1.3 +++ embedaddon/php/ext/standard/array.c 2013/10/14 08:02:34 1.1.1.4 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.1.1.3 2013/07/22 01:32:04 misho Exp $ */ +/* $Id: array.c,v 1.1.1.4 2013/10/14 08:02:34 misho Exp $ */ #include "php.h" #include "php_ini.h" @@ -352,7 +352,7 @@ PHP_FUNCTION(count) /* Numbers are always smaller than strings int this function as it * anyway doesn't make much sense to compare two different data types. - * This keeps it consistant and simple. + * This keeps it consistent and simple. * * This is not correct any more, depends on what compare_func is set to. */ @@ -1053,7 +1053,7 @@ PHP_FUNCTION(max) static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive TSRMLS_DC) /* {{{ */ { zval **args[3], /* Arguments to userland function */ - *retval_ptr, /* Return value - unused */ + *retval_ptr = NULL, /* Return value - unused */ *key=NULL; /* Entry key */ char *string_key; uint string_key_len; @@ -2877,7 +2877,7 @@ static int zval_compare(zval **a, zval **b TSRMLS_DC) static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ { zval **args[2]; - zval *retval_ptr; + zval *retval_ptr = NULL; args[0] = (zval **) a; args[1] = (zval **) b; @@ -2996,8 +2996,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARA char *param_spec; zend_fcall_info fci1, fci2; zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache; - zend_fcall_info *fci_key, *fci_data; - zend_fcall_info_cache *fci_key_cache, *fci_data_cache; + zend_fcall_info *fci_key = NULL, *fci_data; + zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache; PHP_ARRAY_CMP_FUNC_VARS; int (*intersect_key_compare_func)(const void *, const void * TSRMLS_DC); @@ -3414,8 +3414,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETER char *param_spec; zend_fcall_info fci1, fci2; zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache; - zend_fcall_info *fci_key, *fci_data; - zend_fcall_info_cache *fci_key_cache, *fci_data_cache; + zend_fcall_info *fci_key = NULL, *fci_data; + zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache; PHP_ARRAY_CMP_FUNC_VARS; int (*diff_key_compare_func)(const void *, const void * TSRMLS_DC); @@ -4019,7 +4019,6 @@ PHP_FUNCTION(array_sum) **entry, entry_n; HashPosition pos; - double dval; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) { return; @@ -4037,17 +4036,7 @@ PHP_FUNCTION(array_sum) entry_n = **entry; zval_copy_ctor(&entry_n); convert_scalar_to_number(&entry_n TSRMLS_CC); - - if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { - dval = (double)Z_LVAL_P(return_value) + (double)Z_LVAL(entry_n); - if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) { - Z_LVAL_P(return_value) += Z_LVAL(entry_n); - continue; - } - } - convert_to_double(return_value); - convert_to_double(&entry_n); - Z_DVAL_P(return_value) += Z_DVAL(entry_n); + fast_add_function(return_value, return_value, &entry_n TSRMLS_CC); } } /* }}} */