@@ -798,7 +798,7 @@ PHP_FUNCTION(imagesetstyle)
798
798
799
799
num_styles = zend_hash_num_elements (Z_ARRVAL_P (styles ));
800
800
if (num_styles == 0 ) {
801
- zend_throw_error ( NULL , "Styles array must not be empty" );
801
+ zend_value_error ( "Styles array must not be empty" );
802
802
return ;
803
803
}
804
804
@@ -885,7 +885,7 @@ PHP_FUNCTION(imagetruecolortopalette)
885
885
}
886
886
887
887
if (ncolors <= 0 || ZEND_LONG_INT_OVFL (ncolors )) {
888
- zend_throw_error ( NULL , "Number of colors has to be greater than zero and no more than %d" , INT_MAX );
888
+ zend_value_error ( "Number of colors has to be greater than zero and no more than %d" , INT_MAX );
889
889
return ;
890
890
}
891
891
@@ -1109,7 +1109,7 @@ PHP_FUNCTION(imagelayereffect)
1109
1109
1110
1110
#define CHECK_RGBA_RANGE (component , name ) \
1111
1111
if (component < 0 || component > gd##name##Max) { \
1112
- zend_throw_error(NULL, #name " component is out of range, must be between 0 and %d (inclusive)", gd##name##Max); \
1112
+ zend_value_error( #name " component is out of range, must be between 0 and %d (inclusive)", gd##name##Max); \
1113
1113
return; \
1114
1114
}
1115
1115
@@ -1712,12 +1712,12 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
1712
1712
}
1713
1713
1714
1714
if (width < 1 ) {
1715
- zend_throw_error ( NULL , "Width must be at least 1" );
1715
+ zend_value_error ( "Width must be at least 1" );
1716
1716
return ;
1717
1717
}
1718
1718
1719
1719
if (height < 1 ) {
1720
- zend_throw_error ( NULL , "Height must be at least 1" );
1720
+ zend_value_error ( "Height must be at least 1" );
1721
1721
return ;
1722
1722
}
1723
1723
@@ -2445,7 +2445,7 @@ PHP_FUNCTION(imagegammacorrect)
2445
2445
}
2446
2446
2447
2447
if ( input <= 0.0 || output <= 0.0 ) {
2448
- zend_throw_error ( NULL , "Gamma values must be positive" );
2448
+ zend_value_error ( "Gamma values must be positive" );
2449
2449
return ;
2450
2450
}
2451
2451
@@ -2786,17 +2786,17 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
2786
2786
2787
2787
nelem = zend_hash_num_elements (Z_ARRVAL_P (POINTS ));
2788
2788
if (nelem < 6 ) {
2789
- zend_throw_error ( NULL , "You must have at least 3 points in your array" );
2789
+ zend_value_error ( "You must have at least 3 points in your array" );
2790
2790
return ;
2791
2791
}
2792
2792
2793
2793
if (npoints <= 0 ) {
2794
- zend_throw_error ( NULL , "You must give a positive number of points" );
2794
+ zend_value_error ( "You must give a positive number of points" );
2795
2795
return ;
2796
2796
}
2797
2797
2798
2798
if (nelem < npoints * 2 ) {
2799
- zend_throw_error ( NULL , "Trying to use %d points in array with only %d points" , npoints , nelem /2 );
2799
+ zend_value_error ( "Trying to use %d points in array with only %d points" , npoints , nelem /2 );
2800
2800
return ;
2801
2801
}
2802
2802
@@ -3698,22 +3698,22 @@ PHP_FUNCTION(imageconvolution)
3698
3698
3699
3699
nelem = zend_hash_num_elements (Z_ARRVAL_P (hash_matrix ));
3700
3700
if (nelem != 3 ) {
3701
- zend_throw_error ( NULL , "Convolution matrix must be a 3x3 array" );
3701
+ zend_value_error ( "Convolution matrix must be a 3x3 array" );
3702
3702
return ;
3703
3703
}
3704
3704
3705
3705
for (i = 0 ; i < 3 ; i ++ ) {
3706
3706
if ((var = zend_hash_index_find (Z_ARRVAL_P (hash_matrix ), (i ))) != NULL && Z_TYPE_P (var ) == IS_ARRAY ) {
3707
3707
if (zend_hash_num_elements (Z_ARRVAL_P (var )) != 3 ) {
3708
- zend_throw_error ( NULL , "Convolution matrix must be a 3x3 array, matrix[%d] only has %d elements" , i , zend_hash_num_elements (Z_ARRVAL_P (var )));
3708
+ zend_value_error ( "Convolution matrix must be a 3x3 array, matrix[%d] only has %d elements" , i , zend_hash_num_elements (Z_ARRVAL_P (var )));
3709
3709
return ;
3710
3710
}
3711
3711
3712
3712
for (j = 0 ; j < 3 ; j ++ ) {
3713
3713
if ((var2 = zend_hash_index_find (Z_ARRVAL_P (var ), j )) != NULL ) {
3714
3714
matrix [i ][j ] = (float ) zval_get_double (var2 );
3715
3715
} else {
3716
- zend_throw_error ( NULL , "Convolution matrix must be a 3x3 array, matrix[%d][%d] cannot be found (missing integer key)" , i , j );
3716
+ zend_value_error ( "Convolution matrix must be a 3x3 array, matrix[%d][%d] cannot be found (missing integer key)" , i , j );
3717
3717
return ;
3718
3718
}
3719
3719
}
@@ -3814,28 +3814,28 @@ PHP_FUNCTION(imagecrop)
3814
3814
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "x" , sizeof ("x" ) - 1 )) != NULL ) {
3815
3815
rect .x = zval_get_long (tmp );
3816
3816
} else {
3817
- zend_throw_error ( NULL , "Cropping rectangle is missing x position" );
3817
+ zend_value_error ( "Cropping rectangle is missing x position" );
3818
3818
return ;
3819
3819
}
3820
3820
3821
3821
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "y" , sizeof ("y" ) - 1 )) != NULL ) {
3822
3822
rect .y = zval_get_long (tmp );
3823
3823
} else {
3824
- zend_throw_error ( NULL , "Cropping rectangle is missing y position" );
3824
+ zend_value_error ( "Cropping rectangle is missing y position" );
3825
3825
return ;
3826
3826
}
3827
3827
3828
3828
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "width" , sizeof ("width" ) - 1 )) != NULL ) {
3829
3829
rect .width = zval_get_long (tmp );
3830
3830
} else {
3831
- zend_throw_error ( NULL , "Cropping rectangle is missing width" );
3831
+ zend_value_error ( "Cropping rectangle is missing width" );
3832
3832
return ;
3833
3833
}
3834
3834
3835
3835
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "height" , sizeof ("height" ) - 1 )) != NULL ) {
3836
3836
rect .height = zval_get_long (tmp );
3837
3837
} else {
3838
- zend_throw_error ( NULL , "Cropping rectangle is missing height" );
3838
+ zend_value_error ( "Cropping rectangle is missing height" );
3839
3839
return ;
3840
3840
}
3841
3841
@@ -3879,14 +3879,14 @@ PHP_FUNCTION(imagecropauto)
3879
3879
3880
3880
case GD_CROP_THRESHOLD :
3881
3881
if (color < 0 || (!gdImageTrueColor (im ) && color >= gdImageColorsTotal (im ))) {
3882
- zend_throw_error ( NULL , "Color argument missing with threshold mode" );
3882
+ zend_value_error ( "Color argument missing with threshold mode" );
3883
3883
return ;
3884
3884
}
3885
3885
im_crop = gdImageCropThreshold (im , color , (float ) threshold );
3886
3886
break ;
3887
3887
3888
3888
default :
3889
- zend_throw_error ( NULL , "Unknown crop mode" );
3889
+ zend_value_error ( "Unknown crop mode" );
3890
3890
return ;
3891
3891
}
3892
3892
@@ -3980,7 +3980,7 @@ PHP_FUNCTION(imageaffine)
3980
3980
}
3981
3981
3982
3982
if ((nelems = zend_hash_num_elements (Z_ARRVAL_P (z_affine ))) != 6 ) {
3983
- zend_throw_error ( NULL , "Affine array must have six elements" );
3983
+ zend_value_error ( "Affine array must have six elements" );
3984
3984
return ;
3985
3985
}
3986
3986
@@ -4007,28 +4007,28 @@ PHP_FUNCTION(imageaffine)
4007
4007
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "x" , sizeof ("x" ) - 1 )) != NULL ) {
4008
4008
rect .x = zval_get_long (tmp );
4009
4009
} else {
4010
- zend_throw_error ( NULL , "Clip array is missing x position" );
4010
+ zend_value_error ( "Clip array is missing x position" );
4011
4011
return ;
4012
4012
}
4013
4013
4014
4014
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "y" , sizeof ("y" ) - 1 )) != NULL ) {
4015
4015
rect .y = zval_get_long (tmp );
4016
4016
} else {
4017
- zend_throw_error ( NULL , "Clip array is missing y position" );
4017
+ zend_value_error ( "Clip array is missing y position" );
4018
4018
return ;
4019
4019
}
4020
4020
4021
4021
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "width" , sizeof ("width" ) - 1 )) != NULL ) {
4022
4022
rect .width = zval_get_long (tmp );
4023
4023
} else {
4024
- zend_throw_error ( NULL , "Clip array is missing width" );
4024
+ zend_value_error ( "Clip array is missing width" );
4025
4025
return ;
4026
4026
}
4027
4027
4028
4028
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "height" , sizeof ("height" ) - 1 )) != NULL ) {
4029
4029
rect .height = zval_get_long (tmp );
4030
4030
} else {
4031
- zend_throw_error ( NULL , "Clip array is missing height" );
4031
+ zend_value_error ( "Clip array is missing height" );
4032
4032
return ;
4033
4033
}
4034
4034
pRect = & rect ;
@@ -4078,14 +4078,14 @@ PHP_FUNCTION(imageaffinematrixget)
4078
4078
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (options ), "x" , sizeof ("x" ) - 1 )) != NULL ) {
4079
4079
x = zval_get_double (tmp );
4080
4080
} else {
4081
- zend_throw_error ( NULL , "Options array is missing x position" );
4081
+ zend_value_error ( "Options array is missing x position" );
4082
4082
return ;
4083
4083
}
4084
4084
4085
4085
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (options ), "y" , sizeof ("y" ) - 1 )) != NULL ) {
4086
4086
y = zval_get_double (tmp );
4087
4087
} else {
4088
- zend_throw_error ( NULL , "Options array is missing y position" );
4088
+ zend_value_error ( "Options array is missing y position" );
4089
4089
return ;
4090
4090
}
4091
4091
@@ -4120,7 +4120,7 @@ PHP_FUNCTION(imageaffinematrixget)
4120
4120
}
4121
4121
4122
4122
default :
4123
- zend_throw_error ( NULL , "Invalid type for element " ZEND_LONG_FMT , type );
4123
+ zend_value_error ( "Invalid type for element " ZEND_LONG_FMT , type );
4124
4124
return ;
4125
4125
}
4126
4126
@@ -4152,7 +4152,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
4152
4152
}
4153
4153
4154
4154
if (((nelems = zend_hash_num_elements (Z_ARRVAL_P (z_m1 ))) != 6 ) || (nelems = zend_hash_num_elements (Z_ARRVAL_P (z_m2 ))) != 6 ) {
4155
- zend_throw_error ( NULL , "Affine arrays must have six elements" );
4155
+ zend_value_error ( "Affine arrays must have six elements" );
4156
4156
return ;
4157
4157
}
4158
4158
0 commit comments