@@ -2725,7 +2725,7 @@ static uint8_t php_range_process_input(const zval *input, uint32_t arg_num, zend
2725
2725
PHP_FUNCTION (range )
2726
2726
{
2727
2727
zval * user_start , * user_end , * user_step = NULL , tmp ;
2728
- bool err = 0 , is_step_double = false;
2728
+ bool is_step_double = false;
2729
2729
double step_double = 1.0 ;
2730
2730
zend_long step = 1 ;
2731
2731
@@ -2830,8 +2830,7 @@ PHP_FUNCTION(range)
2830
2830
2831
2831
if (low > high ) { /* Negative Steps */
2832
2832
if (low - high < step ) {
2833
- err = 1 ;
2834
- goto err ;
2833
+ goto boundary_error ;
2835
2834
}
2836
2835
/* Initialize the return_value as an array. */
2837
2836
array_init_size (return_value , (uint32_t )(((low - high ) / step ) + 1 ));
@@ -2847,8 +2846,7 @@ PHP_FUNCTION(range)
2847
2846
} ZEND_HASH_FILL_END ();
2848
2847
} else if (high > low ) { /* Positive Steps */
2849
2848
if (high - low < step ) {
2850
- err = 1 ;
2851
- goto err ;
2849
+ goto boundary_error ;
2852
2850
}
2853
2851
array_init_size (return_value , (uint32_t )(((high - low ) / step ) + 1 ));
2854
2852
zend_hash_real_init_packed (Z_ARRVAL_P (return_value ));
@@ -2876,8 +2874,7 @@ PHP_FUNCTION(range)
2876
2874
2877
2875
if (start_double > end_double ) { /* Negative steps */
2878
2876
if (start_double - end_double < step_double ) {
2879
- err = 1 ;
2880
- goto err ;
2877
+ goto boundary_error ;
2881
2878
}
2882
2879
2883
2880
RANGE_CHECK_DOUBLE_INIT_ARRAY (start_double , end_double , step_double );
@@ -2890,8 +2887,7 @@ PHP_FUNCTION(range)
2890
2887
} ZEND_HASH_FILL_END ();
2891
2888
} else if (end_double > start_double ) { /* Positive steps */
2892
2889
if (end_double - start_double < step_double ) {
2893
- err = 1 ;
2894
- goto err ;
2890
+ goto boundary_error ;
2895
2891
}
2896
2892
2897
2893
RANGE_CHECK_DOUBLE_INIT_ARRAY (end_double , start_double , step_double );
@@ -2915,8 +2911,7 @@ PHP_FUNCTION(range)
2915
2911
2916
2912
if (start_long > end_long ) { /* Negative steps */
2917
2913
if ((zend_ulong )start_long - end_long < unsigned_step ) {
2918
- err = 1 ;
2919
- goto err ;
2914
+ goto boundary_error ;
2920
2915
}
2921
2916
2922
2917
RANGE_CHECK_LONG_INIT_ARRAY (start_long , end_long , unsigned_step );
@@ -2929,8 +2924,7 @@ PHP_FUNCTION(range)
2929
2924
} ZEND_HASH_FILL_END ();
2930
2925
} else if (end_long > start_long ) { /* Positive steps */
2931
2926
if ((zend_ulong )end_long - start_long < unsigned_step ) {
2932
- err = 1 ;
2933
- goto err ;
2927
+ goto boundary_error ;
2934
2928
}
2935
2929
2936
2930
RANGE_CHECK_LONG_INIT_ARRAY (end_long , start_long , unsigned_step );
@@ -2947,11 +2941,11 @@ PHP_FUNCTION(range)
2947
2941
zend_hash_next_index_insert_new (Z_ARRVAL_P (return_value ), & tmp );
2948
2942
}
2949
2943
}
2950
- err :
2951
- if ( err ) {
2952
- zend_argument_value_error ( 3 , "must be less than the range spanned by argument #1 ($start) and argument #2 ($end)" );
2953
- RETURN_THROWS ( );
2954
- }
2944
+ return ;
2945
+
2946
+ boundary_error :
2947
+ zend_argument_value_error ( 3 , "must be less than the range spanned by argument #1 ($start) and argument #2 ($end)" );
2948
+ RETURN_THROWS ();
2955
2949
}
2956
2950
/* }}} */
2957
2951
0 commit comments