@@ -2753,7 +2753,7 @@ static uint8_t php_range_process_input(const zval *input, uint32_t arg_num, zend
2753
2753
PHP_FUNCTION (range )
2754
2754
{
2755
2755
zval * user_start , * user_end , * user_step = NULL , tmp ;
2756
- bool err = 0 , is_step_double = false;
2756
+ bool is_step_double = false;
2757
2757
double step_double = 1.0 ;
2758
2758
zend_long step = 1 ;
2759
2759
@@ -2858,8 +2858,7 @@ PHP_FUNCTION(range)
2858
2858
2859
2859
if (low > high ) { /* Negative Steps */
2860
2860
if (low - high < step ) {
2861
- err = 1 ;
2862
- goto err ;
2861
+ goto boundary_error ;
2863
2862
}
2864
2863
/* Initialize the return_value as an array. */
2865
2864
array_init_size (return_value , (uint32_t )(((low - high ) / step ) + 1 ));
@@ -2875,8 +2874,7 @@ PHP_FUNCTION(range)
2875
2874
} ZEND_HASH_FILL_END ();
2876
2875
} else if (high > low ) { /* Positive Steps */
2877
2876
if (high - low < step ) {
2878
- err = 1 ;
2879
- goto err ;
2877
+ goto boundary_error ;
2880
2878
}
2881
2879
array_init_size (return_value , (uint32_t )(((high - low ) / step ) + 1 ));
2882
2880
zend_hash_real_init_packed (Z_ARRVAL_P (return_value ));
@@ -2904,8 +2902,7 @@ PHP_FUNCTION(range)
2904
2902
2905
2903
if (start_double > end_double ) { /* Negative steps */
2906
2904
if (start_double - end_double < step_double ) {
2907
- err = 1 ;
2908
- goto err ;
2905
+ goto boundary_error ;
2909
2906
}
2910
2907
2911
2908
RANGE_CHECK_DOUBLE_INIT_ARRAY (start_double , end_double , step_double );
@@ -2918,8 +2915,7 @@ PHP_FUNCTION(range)
2918
2915
} ZEND_HASH_FILL_END ();
2919
2916
} else if (end_double > start_double ) { /* Positive steps */
2920
2917
if (end_double - start_double < step_double ) {
2921
- err = 1 ;
2922
- goto err ;
2918
+ goto boundary_error ;
2923
2919
}
2924
2920
2925
2921
RANGE_CHECK_DOUBLE_INIT_ARRAY (end_double , start_double , step_double );
@@ -2943,8 +2939,7 @@ PHP_FUNCTION(range)
2943
2939
2944
2940
if (start_long > end_long ) { /* Negative steps */
2945
2941
if ((zend_ulong )start_long - end_long < unsigned_step ) {
2946
- err = 1 ;
2947
- goto err ;
2942
+ goto boundary_error ;
2948
2943
}
2949
2944
2950
2945
RANGE_CHECK_LONG_INIT_ARRAY (start_long , end_long , unsigned_step );
@@ -2957,8 +2952,7 @@ PHP_FUNCTION(range)
2957
2952
} ZEND_HASH_FILL_END ();
2958
2953
} else if (end_long > start_long ) { /* Positive steps */
2959
2954
if ((zend_ulong )end_long - start_long < unsigned_step ) {
2960
- err = 1 ;
2961
- goto err ;
2955
+ goto boundary_error ;
2962
2956
}
2963
2957
2964
2958
RANGE_CHECK_LONG_INIT_ARRAY (end_long , start_long , unsigned_step );
@@ -2975,11 +2969,11 @@ PHP_FUNCTION(range)
2975
2969
zend_hash_next_index_insert_new (Z_ARRVAL_P (return_value ), & tmp );
2976
2970
}
2977
2971
}
2978
- err :
2979
- if ( err ) {
2980
- zend_argument_value_error ( 3 , "must be less than the range spanned by argument #1 ($start) and argument #2 ($end)" );
2981
- RETURN_THROWS ( );
2982
- }
2972
+ return ;
2973
+
2974
+ boundary_error :
2975
+ zend_argument_value_error ( 3 , "must be less than the range spanned by argument #1 ($start) and argument #2 ($end)" );
2976
+ RETURN_THROWS ();
2983
2977
}
2984
2978
/* }}} */
2985
2979
0 commit comments