@@ -886,7 +886,7 @@ PHP_FUNCTION(imagesetstyle)
886
886
num_styles = zend_hash_num_elements (Z_ARRVAL_P (styles ));
887
887
if (num_styles == 0 ) {
888
888
zend_value_error ("Styles array must not be empty" );
889
- return ;
889
+ RETURN_THROWS () ;
890
890
}
891
891
892
892
/* copy the style values in the stylearr */
@@ -917,12 +917,12 @@ PHP_FUNCTION(imagecreatetruecolor)
917
917
918
918
if (x_size <= 0 || x_size >= INT_MAX ) {
919
919
zend_value_error ("Invalid width (x_size)" );
920
- return ;
920
+ RETURN_THROWS () ;
921
921
}
922
922
923
923
if (y_size <= 0 || y_size >= INT_MAX ) {
924
924
zend_value_error ("Invalid height (y_size)" );
925
- return ;
925
+ RETURN_THROWS () ;
926
926
}
927
927
928
928
im = gdImageCreateTrueColor (x_size , y_size );
@@ -969,7 +969,7 @@ PHP_FUNCTION(imagetruecolortopalette)
969
969
970
970
if (ncolors <= 0 || ZEND_LONG_INT_OVFL (ncolors )) {
971
971
zend_value_error ("Number of colors has to be greater than zero and no more than %d" , INT_MAX );
972
- return ;
972
+ RETURN_THROWS () ;
973
973
}
974
974
975
975
if (gdImageTrueColorToPalette (im , dither , (int )ncolors )) {
@@ -1174,7 +1174,7 @@ PHP_FUNCTION(imagelayereffect)
1174
1174
#define CHECK_RGBA_RANGE (component , name ) \
1175
1175
if (component < 0 || component > gd##name##Max) { \
1176
1176
zend_value_error(#name " component is out of range, must be between 0 and %d (inclusive)", gd##name##Max); \
1177
- return ; \
1177
+ RETURN_THROWS() ; \
1178
1178
}
1179
1179
1180
1180
/* {{{ proto int imagecolorallocatealpha(resource im, int red, int green, int blue, int alpha)
@@ -1512,12 +1512,12 @@ PHP_FUNCTION(imagecreate)
1512
1512
1513
1513
if (x_size <= 0 || x_size >= INT_MAX ) {
1514
1514
zend_value_error ("Invalid width (x_size)" );
1515
- return ;
1515
+ RETURN_THROWS () ;
1516
1516
}
1517
1517
1518
1518
if (y_size <= 0 || y_size >= INT_MAX ) {
1519
1519
zend_value_error ("Invalid height (y_size)" );
1520
- return ;
1520
+ RETURN_THROWS () ;
1521
1521
}
1522
1522
1523
1523
im = gdImageCreate (x_size , y_size );
@@ -1751,12 +1751,12 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
1751
1751
1752
1752
if (width < 1 ) {
1753
1753
zend_value_error ("Width must be at least 1" );
1754
- return ;
1754
+ RETURN_THROWS () ;
1755
1755
}
1756
1756
1757
1757
if (height < 1 ) {
1758
1758
zend_value_error ("Height must be at least 1" );
1759
- return ;
1759
+ RETURN_THROWS () ;
1760
1760
}
1761
1761
1762
1762
} else {
@@ -2307,7 +2307,7 @@ PHP_FUNCTION(imagecolordeallocate)
2307
2307
RETURN_TRUE ;
2308
2308
} else {
2309
2309
zend_value_error ("Color index %d out of range" , col );
2310
- return ;
2310
+ RETURN_THROWS () ;
2311
2311
}
2312
2312
}
2313
2313
/* }}} */
@@ -2435,7 +2435,7 @@ PHP_FUNCTION(imagegammacorrect)
2435
2435
2436
2436
if ( input <= 0.0 || output <= 0.0 ) {
2437
2437
zend_value_error ("Gamma values must be positive" );
2438
- return ;
2438
+ RETURN_THROWS () ;
2439
2439
}
2440
2440
2441
2441
gamma = input / output ;
@@ -2744,7 +2744,7 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
2744
2744
NPOINTS = zend_hash_num_elements (Z_ARRVAL_P (POINTS ));
2745
2745
if (NPOINTS % 2 != 0 ) {
2746
2746
zend_value_error ("Points array must have an even number of elements" );
2747
- return ;
2747
+ RETURN_THROWS () ;
2748
2748
}
2749
2749
NPOINTS /= 2 ;
2750
2750
}
@@ -2757,12 +2757,12 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
2757
2757
nelem = zend_hash_num_elements (Z_ARRVAL_P (POINTS ));
2758
2758
if (npoints < 3 ) {
2759
2759
zend_value_error ("Polygon must have at least 3 points" );
2760
- return ;
2760
+ RETURN_THROWS () ;
2761
2761
}
2762
2762
2763
2763
if (nelem < npoints * 2 ) {
2764
2764
zend_value_error ("Trying to use %d points in array with only %d points" , npoints , nelem /2 );
2765
- return ;
2765
+ RETURN_THROWS () ;
2766
2766
}
2767
2767
2768
2768
points = (gdPointPtr ) safe_emalloc (npoints , sizeof (gdPoint ), 0 );
@@ -3134,7 +3134,7 @@ PHP_FUNCTION(imagecopyresized)
3134
3134
3135
3135
if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0 ) {
3136
3136
zend_value_error ("Invalid image dimensions" );
3137
- return ;
3137
+ RETURN_THROWS () ;
3138
3138
}
3139
3139
3140
3140
gdImageCopyResized (im_dst , im_src , dstX , dstY , srcX , srcY , dstW , dstH , srcW , srcH );
@@ -3616,22 +3616,22 @@ PHP_FUNCTION(imageconvolution)
3616
3616
nelem = zend_hash_num_elements (Z_ARRVAL_P (hash_matrix ));
3617
3617
if (nelem != 3 ) {
3618
3618
zend_value_error ("Convolution matrix must be a 3x3 array" );
3619
- return ;
3619
+ RETURN_THROWS () ;
3620
3620
}
3621
3621
3622
3622
for (i = 0 ; i < 3 ; i ++ ) {
3623
3623
if ((var = zend_hash_index_find (Z_ARRVAL_P (hash_matrix ), (i ))) != NULL && Z_TYPE_P (var ) == IS_ARRAY ) {
3624
3624
if (zend_hash_num_elements (Z_ARRVAL_P (var )) != 3 ) {
3625
3625
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 )));
3626
- return ;
3626
+ RETURN_THROWS () ;
3627
3627
}
3628
3628
3629
3629
for (j = 0 ; j < 3 ; j ++ ) {
3630
3630
if ((var2 = zend_hash_index_find (Z_ARRVAL_P (var ), j )) != NULL ) {
3631
3631
matrix [i ][j ] = (float ) zval_get_double (var2 );
3632
3632
} else {
3633
3633
zend_value_error ("Convolution matrix must be a 3x3 array, matrix[%d][%d] cannot be found (missing integer key)" , i , j );
3634
- return ;
3634
+ RETURN_THROWS () ;
3635
3635
}
3636
3636
}
3637
3637
}
@@ -3676,7 +3676,7 @@ PHP_FUNCTION(imageflip)
3676
3676
3677
3677
default :
3678
3678
zend_value_error ("Unknown flip mode" );
3679
- return ;
3679
+ RETURN_THROWS () ;
3680
3680
}
3681
3681
3682
3682
RETURN_TRUE ;
@@ -3725,28 +3725,28 @@ PHP_FUNCTION(imagecrop)
3725
3725
rect .x = zval_get_long (tmp );
3726
3726
} else {
3727
3727
zend_value_error ("Cropping rectangle is missing x position" );
3728
- return ;
3728
+ RETURN_THROWS () ;
3729
3729
}
3730
3730
3731
3731
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "y" , sizeof ("y" ) - 1 )) != NULL ) {
3732
3732
rect .y = zval_get_long (tmp );
3733
3733
} else {
3734
3734
zend_value_error ("Cropping rectangle is missing y position" );
3735
- return ;
3735
+ RETURN_THROWS () ;
3736
3736
}
3737
3737
3738
3738
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "width" , sizeof ("width" ) - 1 )) != NULL ) {
3739
3739
rect .width = zval_get_long (tmp );
3740
3740
} else {
3741
3741
zend_value_error ("Cropping rectangle is missing width" );
3742
- return ;
3742
+ RETURN_THROWS () ;
3743
3743
}
3744
3744
3745
3745
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "height" , sizeof ("height" ) - 1 )) != NULL ) {
3746
3746
rect .height = zval_get_long (tmp );
3747
3747
} else {
3748
3748
zend_value_error ("Cropping rectangle is missing height" );
3749
- return ;
3749
+ RETURN_THROWS () ;
3750
3750
}
3751
3751
3752
3752
im_crop = gdImageCrop (im , & rect );
@@ -3788,14 +3788,14 @@ PHP_FUNCTION(imagecropauto)
3788
3788
case GD_CROP_THRESHOLD :
3789
3789
if (color < 0 || (!gdImageTrueColor (im ) && color >= gdImageColorsTotal (im ))) {
3790
3790
zend_value_error ("Color argument missing with threshold mode" );
3791
- return ;
3791
+ RETURN_THROWS () ;
3792
3792
}
3793
3793
im_crop = gdImageCropThreshold (im , color , (float ) threshold );
3794
3794
break ;
3795
3795
3796
3796
default :
3797
3797
zend_value_error ("Unknown crop mode" );
3798
- return ;
3798
+ RETURN_THROWS () ;
3799
3799
}
3800
3800
3801
3801
if (im_crop == NULL ) {
@@ -3885,7 +3885,7 @@ PHP_FUNCTION(imageaffine)
3885
3885
3886
3886
if ((nelems = zend_hash_num_elements (Z_ARRVAL_P (z_affine ))) != 6 ) {
3887
3887
zend_value_error ("Affine array must have six elements" );
3888
- return ;
3888
+ RETURN_THROWS () ;
3889
3889
}
3890
3890
3891
3891
for (i = 0 ; i < nelems ; i ++ ) {
@@ -3912,28 +3912,28 @@ PHP_FUNCTION(imageaffine)
3912
3912
rect .x = zval_get_long (tmp );
3913
3913
} else {
3914
3914
zend_value_error ("Clip array is missing x position" );
3915
- return ;
3915
+ RETURN_THROWS () ;
3916
3916
}
3917
3917
3918
3918
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "y" , sizeof ("y" ) - 1 )) != NULL ) {
3919
3919
rect .y = zval_get_long (tmp );
3920
3920
} else {
3921
3921
zend_value_error ("Clip array is missing y position" );
3922
- return ;
3922
+ RETURN_THROWS () ;
3923
3923
}
3924
3924
3925
3925
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "width" , sizeof ("width" ) - 1 )) != NULL ) {
3926
3926
rect .width = zval_get_long (tmp );
3927
3927
} else {
3928
3928
zend_value_error ("Clip array is missing width" );
3929
- return ;
3929
+ RETURN_THROWS () ;
3930
3930
}
3931
3931
3932
3932
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (z_rect ), "height" , sizeof ("height" ) - 1 )) != NULL ) {
3933
3933
rect .height = zval_get_long (tmp );
3934
3934
} else {
3935
3935
zend_value_error ("Clip array is missing height" );
3936
- return ;
3936
+ RETURN_THROWS () ;
3937
3937
}
3938
3938
pRect = & rect ;
3939
3939
} else {
@@ -3983,14 +3983,14 @@ PHP_FUNCTION(imageaffinematrixget)
3983
3983
x = zval_get_double (tmp );
3984
3984
} else {
3985
3985
zend_value_error ("Options array is missing x position" );
3986
- return ;
3986
+ RETURN_THROWS () ;
3987
3987
}
3988
3988
3989
3989
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (options ), "y" , sizeof ("y" ) - 1 )) != NULL ) {
3990
3990
y = zval_get_double (tmp );
3991
3991
} else {
3992
3992
zend_value_error ("Options array is missing y position" );
3993
- return ;
3993
+ RETURN_THROWS () ;
3994
3994
}
3995
3995
3996
3996
if (type == GD_AFFINE_TRANSLATE ) {
@@ -4025,7 +4025,7 @@ PHP_FUNCTION(imageaffinematrixget)
4025
4025
4026
4026
default :
4027
4027
zend_value_error ("Invalid type for element " ZEND_LONG_FMT , type );
4028
- return ;
4028
+ RETURN_THROWS () ;
4029
4029
}
4030
4030
4031
4031
if (res == GD_FALSE ) {
@@ -4057,7 +4057,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
4057
4057
4058
4058
if (((nelems = zend_hash_num_elements (Z_ARRVAL_P (z_m1 ))) != 6 ) || (nelems = zend_hash_num_elements (Z_ARRVAL_P (z_m2 ))) != 6 ) {
4059
4059
zend_value_error ("Affine arrays must have six elements" );
4060
- return ;
4060
+ RETURN_THROWS () ;
4061
4061
}
4062
4062
4063
4063
for (i = 0 ; i < 6 ; i ++ ) {
0 commit comments