@@ -2839,7 +2839,7 @@ static uint8_t php_range_process_input(const zval *input, uint32_t arg_num, zend
2839
2839
PHP_FUNCTION (range )
2840
2840
{
2841
2841
zval * user_start , * user_end , * user_step = NULL , tmp ;
2842
- bool err = 0 , is_step_double = false;
2842
+ bool is_step_double = false;
2843
2843
double step_double = 1.0 ;
2844
2844
zend_long step = 1 ;
2845
2845
@@ -2944,8 +2944,7 @@ PHP_FUNCTION(range)
2944
2944
2945
2945
if (low > high ) { /* Negative Steps */
2946
2946
if (low - high < step ) {
2947
- err = 1 ;
2948
- goto err ;
2947
+ goto boundary_error ;
2949
2948
}
2950
2949
/* Initialize the return_value as an array. */
2951
2950
array_init_size (return_value , (uint32_t )(((low - high ) / step ) + 1 ));
@@ -2961,8 +2960,7 @@ PHP_FUNCTION(range)
2961
2960
} ZEND_HASH_FILL_END ();
2962
2961
} else if (high > low ) { /* Positive Steps */
2963
2962
if (high - low < step ) {
2964
- err = 1 ;
2965
- goto err ;
2963
+ goto boundary_error ;
2966
2964
}
2967
2965
array_init_size (return_value , (uint32_t )(((high - low ) / step ) + 1 ));
2968
2966
zend_hash_real_init_packed (Z_ARRVAL_P (return_value ));
@@ -2990,8 +2988,7 @@ PHP_FUNCTION(range)
2990
2988
2991
2989
if (start_double > end_double ) { /* Negative steps */
2992
2990
if (start_double - end_double < step_double ) {
2993
- err = 1 ;
2994
- goto err ;
2991
+ goto boundary_error ;
2995
2992
}
2996
2993
2997
2994
RANGE_CHECK_DOUBLE_INIT_ARRAY (start_double , end_double , step_double );
@@ -3004,8 +3001,7 @@ PHP_FUNCTION(range)
3004
3001
} ZEND_HASH_FILL_END ();
3005
3002
} else if (end_double > start_double ) { /* Positive steps */
3006
3003
if (end_double - start_double < step_double ) {
3007
- err = 1 ;
3008
- goto err ;
3004
+ goto boundary_error ;
3009
3005
}
3010
3006
3011
3007
RANGE_CHECK_DOUBLE_INIT_ARRAY (end_double , start_double , step_double );
@@ -3029,8 +3025,7 @@ PHP_FUNCTION(range)
3029
3025
3030
3026
if (start_long > end_long ) { /* Negative steps */
3031
3027
if ((zend_ulong )start_long - end_long < unsigned_step ) {
3032
- err = 1 ;
3033
- goto err ;
3028
+ goto boundary_error ;
3034
3029
}
3035
3030
3036
3031
RANGE_CHECK_LONG_INIT_ARRAY (start_long , end_long , unsigned_step );
@@ -3043,8 +3038,7 @@ PHP_FUNCTION(range)
3043
3038
} ZEND_HASH_FILL_END ();
3044
3039
} else if (end_long > start_long ) { /* Positive steps */
3045
3040
if ((zend_ulong )end_long - start_long < unsigned_step ) {
3046
- err = 1 ;
3047
- goto err ;
3041
+ goto boundary_error ;
3048
3042
}
3049
3043
3050
3044
RANGE_CHECK_LONG_INIT_ARRAY (end_long , start_long , unsigned_step );
@@ -3061,11 +3055,11 @@ PHP_FUNCTION(range)
3061
3055
zend_hash_next_index_insert_new (Z_ARRVAL_P (return_value ), & tmp );
3062
3056
}
3063
3057
}
3064
- err :
3065
- if ( err ) {
3066
- zend_argument_value_error ( 3 , "must be less than the range spanned by argument #1 ($start) and argument #2 ($end)" );
3067
- RETURN_THROWS ( );
3068
- }
3058
+ return ;
3059
+
3060
+ boundary_error :
3061
+ zend_argument_value_error ( 3 , "must be less than the range spanned by argument #1 ($start) and argument #2 ($end)" );
3062
+ RETURN_THROWS ();
3069
3063
}
3070
3064
/* }}} */
3071
3065
0 commit comments