@@ -3980,8 +3980,8 @@ PHP_FUNCTION(imageaffine)
3980
3980
}
3981
3981
3982
3982
if ((nelems = zend_hash_num_elements (Z_ARRVAL_P (z_affine ))) != 6 ) {
3983
- php_error_docref (NULL , E_WARNING , "Affine array must have six elements" );
3984
- RETURN_FALSE ;
3983
+ zend_throw_error (NULL , "Affine array must have six elements" );
3984
+ return ;
3985
3985
}
3986
3986
3987
3987
for (i = 0 ; i < nelems ; i ++ ) {
@@ -3997,8 +3997,8 @@ PHP_FUNCTION(imageaffine)
3997
3997
affine [i ] = zval_get_double (zval_affine_elem );
3998
3998
break ;
3999
3999
default :
4000
- php_error_docref ( NULL , E_WARNING , "Invalid type for element %i" , i );
4001
- RETURN_FALSE ;
4000
+ zend_type_error ( "Invalid type for element %i" , i );
4001
+ return ;
4002
4002
}
4003
4003
}
4004
4004
}
@@ -4007,29 +4007,29 @@ 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
- php_error_docref (NULL , E_WARNING , "Missing x position" );
4011
- RETURN_FALSE ;
4010
+ zend_throw_error (NULL , "Clip array is missing x position" );
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
- php_error_docref (NULL , E_WARNING , "Missing y position" );
4018
- RETURN_FALSE ;
4017
+ zend_throw_error (NULL , "Clip array is missing y position" );
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
- php_error_docref (NULL , E_WARNING , "Missing width" );
4025
- RETURN_FALSE ;
4024
+ zend_throw_error (NULL , "Clip array is missing width" );
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
- php_error_docref (NULL , E_WARNING , "Missing height" );
4032
- RETURN_FALSE ;
4031
+ zend_throw_error (NULL , "Clip array is missing height" );
4032
+ return ;
4033
4033
}
4034
4034
pRect = & rect ;
4035
4035
} else {
@@ -4071,21 +4071,22 @@ PHP_FUNCTION(imageaffinematrixget)
4071
4071
case GD_AFFINE_SCALE : {
4072
4072
double x , y ;
4073
4073
if (!options || Z_TYPE_P (options ) != IS_ARRAY ) {
4074
- php_error_docref ( NULL , E_WARNING , "Array expected as options" );
4075
- RETURN_FALSE ;
4074
+ zend_type_error ( "Array expected as options when using translate or scale " );
4075
+ return ;
4076
4076
}
4077
+
4077
4078
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (options ), "x" , sizeof ("x" ) - 1 )) != NULL ) {
4078
4079
x = zval_get_double (tmp );
4079
4080
} else {
4080
- php_error_docref (NULL , E_WARNING , "Missing x position" );
4081
- RETURN_FALSE ;
4081
+ zend_throw_error (NULL , "Options array is missing x position" );
4082
+ return ;
4082
4083
}
4083
4084
4084
4085
if ((tmp = zend_hash_str_find (Z_ARRVAL_P (options ), "y" , sizeof ("y" ) - 1 )) != NULL ) {
4085
4086
y = zval_get_double (tmp );
4086
4087
} else {
4087
- php_error_docref (NULL , E_WARNING , "Missing y position" );
4088
- RETURN_FALSE ;
4088
+ zend_throw_error (NULL , "Options array is missing y position" );
4089
+ return ;
4089
4090
}
4090
4091
4091
4092
if (type == GD_AFFINE_TRANSLATE ) {
@@ -4102,8 +4103,8 @@ PHP_FUNCTION(imageaffinematrixget)
4102
4103
double angle ;
4103
4104
4104
4105
if (!options ) {
4105
- php_error_docref ( NULL , E_WARNING , "Number is expected as option" );
4106
- RETURN_FALSE ;
4106
+ zend_type_error ( "Number is expected as option when using rotate or shear " );
4107
+ return ;
4107
4108
}
4108
4109
4109
4110
angle = zval_get_double (options );
@@ -4119,8 +4120,8 @@ PHP_FUNCTION(imageaffinematrixget)
4119
4120
}
4120
4121
4121
4122
default :
4122
- php_error_docref (NULL , E_WARNING , "Invalid type for element " ZEND_LONG_FMT , type );
4123
- RETURN_FALSE ;
4123
+ zend_throw_error (NULL , "Invalid type for element " ZEND_LONG_FMT , type );
4124
+ return ;
4124
4125
}
4125
4126
4126
4127
if (res == GD_FALSE ) {
@@ -4151,8 +4152,8 @@ PHP_FUNCTION(imageaffinematrixconcat)
4151
4152
}
4152
4153
4153
4154
if (((nelems = zend_hash_num_elements (Z_ARRVAL_P (z_m1 ))) != 6 ) || (nelems = zend_hash_num_elements (Z_ARRVAL_P (z_m2 ))) != 6 ) {
4154
- php_error_docref (NULL , E_WARNING , "Affine arrays must have six elements" );
4155
- RETURN_FALSE ;
4155
+ zend_throw_error (NULL , "Affine arrays must have six elements" );
4156
+ return ;
4156
4157
}
4157
4158
4158
4159
for (i = 0 ; i < 6 ; i ++ ) {
@@ -4168,10 +4169,11 @@ PHP_FUNCTION(imageaffinematrixconcat)
4168
4169
m1 [i ] = zval_get_double (tmp );
4169
4170
break ;
4170
4171
default :
4171
- php_error_docref ( NULL , E_WARNING , "Invalid type for element %i" , i );
4172
- RETURN_FALSE ;
4172
+ zend_type_error ( "Matrix 1 contains invalid type for element %i" , i );
4173
+ return ;
4173
4174
}
4174
4175
}
4176
+
4175
4177
if ((tmp = zend_hash_index_find (Z_ARRVAL_P (z_m2 ), i )) != NULL ) {
4176
4178
switch (Z_TYPE_P (tmp )) {
4177
4179
case IS_LONG :
@@ -4184,8 +4186,8 @@ PHP_FUNCTION(imageaffinematrixconcat)
4184
4186
m2 [i ] = zval_get_double (tmp );
4185
4187
break ;
4186
4188
default :
4187
- php_error_docref ( NULL , E_WARNING , "Invalid type for element %i" , i );
4188
- RETURN_FALSE ;
4189
+ zend_type_error ( "Matrix 2 contains invalid type for element %i" , i );
4190
+ return ;
4189
4191
}
4190
4192
}
4191
4193
}
0 commit comments