File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 3
3
?? ??? 2013, PHP 5.4.19
4
4
5
5
- Core.
6
+ . Fixed bug #65304 (Use of max int in array_sum). (Laruence)
6
7
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
7
8
limited case). (Arpad)
8
9
. Improve fix for bug #63186 (compile failure on netbsd). (Matteo)
Original file line number Diff line number Diff line change @@ -4037,17 +4037,7 @@ PHP_FUNCTION(array_sum)
4037
4037
entry_n = * * entry ;
4038
4038
zval_copy_ctor (& entry_n );
4039
4039
convert_scalar_to_number (& entry_n TSRMLS_CC );
4040
-
4041
- if (Z_TYPE (entry_n ) == IS_LONG && Z_TYPE_P (return_value ) == IS_LONG ) {
4042
- dval = (double )Z_LVAL_P (return_value ) + (double )Z_LVAL (entry_n );
4043
- if ( (double )LONG_MIN <= dval && dval <= (double )LONG_MAX ) {
4044
- Z_LVAL_P (return_value ) += Z_LVAL (entry_n );
4045
- continue ;
4046
- }
4047
- }
4048
- convert_to_double (return_value );
4049
- convert_to_double (& entry_n );
4050
- Z_DVAL_P (return_value ) += Z_DVAL (entry_n );
4040
+ fast_add_function (return_value , return_value , & entry_n TSRMLS_CC );
4051
4041
}
4052
4042
}
4053
4043
/* }}} */
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #65304 (Use of max int in array_sum)
3
+ --FILE--
4
+ <?php
5
+ var_dump (array_sum (array (PHP_INT_MAX , 1 )));
6
+ var_dump (PHP_INT_MAX + 1 );
7
+ ?>
8
+ --EXPECTF--
9
+ float(%s)
10
+ float(%s)
You can’t perform that action at this time.
0 commit comments