@@ -861,20 +861,20 @@ PHP_FUNCTION(imagecolormatch)
861
861
result = gdImageColorMatch (im1 , im2 );
862
862
switch (result ) {
863
863
case -1 :
864
- php_error_docref ( NULL , E_WARNING , "Image1 must be TrueColor" );
865
- RETURN_FALSE ;
864
+ zend_argument_value_error ( 1 , " must be TrueColor" );
865
+ RETURN_THROWS () ;
866
866
break ;
867
867
case -2 :
868
- php_error_docref ( NULL , E_WARNING , "Image2 must be Palette" );
869
- RETURN_FALSE ;
868
+ zend_argument_value_error ( 2 , " must be Palette" );
869
+ RETURN_THROWS () ;
870
870
break ;
871
871
case -3 :
872
- php_error_docref ( NULL , E_WARNING , "Image1 and Image2 must be the same size" );
873
- RETURN_FALSE ;
872
+ zend_argument_value_error ( 2 , " must be the same size as argument #1 ($im1)" );
873
+ RETURN_THROWS () ;
874
874
break ;
875
875
case -4 :
876
- php_error_docref ( NULL , E_WARNING , "Image2 must have at least one color" );
877
- RETURN_FALSE ;
876
+ zend_argument_value_error ( 2 , " must have at least one color" );
877
+ RETURN_THROWS () ;
878
878
break ;
879
879
}
880
880
@@ -1459,7 +1459,7 @@ gdImagePtr _php_image_create_from_string(zend_string *data, char *tn, gdImagePtr
1459
1459
1460
1460
im = (* ioctx_func_p )(io_ctx );
1461
1461
if (!im ) {
1462
- php_error_docref (NULL , E_WARNING , "Passed data is not in '%s' format" , tn );
1462
+ php_error_docref (NULL , E_WARNING , "Passed data is not in \"%s\" format" , tn );
1463
1463
io_ctx -> gd_free (io_ctx );
1464
1464
return NULL ;
1465
1465
}
@@ -1483,8 +1483,8 @@ PHP_FUNCTION(imagecreatefromstring)
1483
1483
}
1484
1484
1485
1485
if (ZSTR_LEN (data ) < sizeof (sig )) {
1486
- php_error_docref ( NULL , E_WARNING , "Empty string or invalid image " );
1487
- RETURN_FALSE ;
1486
+ zend_argument_value_error ( 1 , "cannot be empty " );
1487
+ RETURN_THROWS () ;
1488
1488
}
1489
1489
1490
1490
memcpy (sig , ZSTR_VAL (data ), sizeof (sig ));
@@ -1666,7 +1666,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
1666
1666
return ;
1667
1667
}
1668
1668
1669
- php_error_docref (NULL , E_WARNING , "'%s' is not a valid %s file" , file , tn );
1669
+ php_error_docref (NULL , E_WARNING , "\"%s\" is not a valid %s file" , file , tn );
1670
1670
out_err :
1671
1671
php_stream_close (stream );
1672
1672
RETURN_FALSE ;
@@ -1806,7 +1806,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
1806
1806
1807
1807
fp = VCWD_FOPEN (fn , "wb" );
1808
1808
if (!fp ) {
1809
- php_error_docref (NULL , E_WARNING , "Unable to open '%s' for writing" , fn );
1809
+ php_error_docref (NULL , E_WARNING , "Unable to open \"%s\" for writing" , fn );
1810
1810
RETURN_FALSE ;
1811
1811
}
1812
1812
@@ -2297,8 +2297,8 @@ PHP_FUNCTION(imagecolorsforindex)
2297
2297
add_assoc_long (return_value ,"blue" , gdImageBlue (im ,col ));
2298
2298
add_assoc_long (return_value ,"alpha" , gdImageAlpha (im ,col ));
2299
2299
} else {
2300
- php_error_docref ( NULL , E_WARNING , "Color index %d out of range", col );
2301
- RETURN_FALSE ;
2300
+ zend_argument_value_error ( 2 , "is out of range" );
2301
+ RETURN_THROWS () ;
2302
2302
}
2303
2303
}
2304
2304
/* }}} */
0 commit comments