From ebb41c9e81acb9963b058e687d5bddabd86401b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Wed, 19 Aug 2020 23:27:53 +0200 Subject: [PATCH] Promote warnings to exceptions in ext/gd --- ext/gd/gd.c | 30 ++++++++++++------------ ext/gd/tests/001-mb.phpt | 2 +- ext/gd/tests/001.phpt | 2 +- ext/gd/tests/bug37346-mb.phpt | 2 +- ext/gd/tests/bug37346.phpt | 2 +- ext/gd/tests/bug37360.phpt | 2 +- ext/gd/tests/bug38112.phpt | 2 +- ext/gd/tests/bug39780.phpt | 2 +- ext/gd/tests/bug39780_extern.phpt | 2 +- ext/gd/tests/bug71912-mb.phpt | 2 +- ext/gd/tests/bug71912.phpt | 2 +- ext/gd/tests/bug72339.phpt | 2 +- ext/gd/tests/bug73161.phpt | 2 +- ext/gd/tests/bug73868.phpt | 2 +- ext/gd/tests/bug73869.phpt | 4 ++-- ext/gd/tests/bug75111.phpt | 2 +- ext/gd/tests/bug75571.phpt | 2 +- ext/gd/tests/bug77195.phpt | 2 +- ext/gd/tests/bug77973.phpt | 2 +- ext/gd/tests/colorclosest.phpt | 22 ++++++++++------- ext/gd/tests/colormatch.phpt | 10 +++++--- ext/gd/tests/crafted_gd2.phpt | 2 +- ext/gd/tests/createfromstring.phpt | 9 ++++--- ext/gd/tests/createfromwbmp2.phpt | 2 +- ext/gd/tests/createfromwbmp2_extern.phpt | 2 +- ext/gd/tests/imagecolormatch_error2.phpt | 13 ++++++---- ext/gd/tests/imagecolormatch_error3.phpt | 13 ++++++---- ext/gd/tests/imagecolormatch_error4.phpt | 13 ++++++---- ext/gd/tests/libgd00086.phpt | 2 +- ext/gd/tests/libgd00086_extern.phpt | 2 +- ext/gd/tests/libgd00094-mb.phpt | 2 +- ext/gd/tests/libgd00094.phpt | 2 +- ext/gd/tests/libgd00101.phpt | 2 +- 33 files changed, 95 insertions(+), 69 deletions(-) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index b015143ad8061..48dd6ecf4518f 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -861,20 +861,20 @@ PHP_FUNCTION(imagecolormatch) result = gdImageColorMatch(im1, im2); switch (result) { case -1: - php_error_docref(NULL, E_WARNING, "Image1 must be TrueColor" ); - RETURN_FALSE; + zend_argument_value_error(1, "must be TrueColor"); + RETURN_THROWS(); break; case -2: - php_error_docref(NULL, E_WARNING, "Image2 must be Palette" ); - RETURN_FALSE; + zend_argument_value_error(2, "must be Palette"); + RETURN_THROWS(); break; case -3: - php_error_docref(NULL, E_WARNING, "Image1 and Image2 must be the same size" ); - RETURN_FALSE; + zend_argument_value_error(2, "must be the same size as argument #1 ($im1)"); + RETURN_THROWS(); break; case -4: - php_error_docref(NULL, E_WARNING, "Image2 must have at least one color" ); - RETURN_FALSE; + zend_argument_value_error(2, "must have at least one color"); + RETURN_THROWS(); break; } @@ -1459,7 +1459,7 @@ gdImagePtr _php_image_create_from_string(zend_string *data, char *tn, gdImagePtr im = (*ioctx_func_p)(io_ctx); if (!im) { - php_error_docref(NULL, E_WARNING, "Passed data is not in '%s' format", tn); + php_error_docref(NULL, E_WARNING, "Passed data is not in \"%s\" format", tn); io_ctx->gd_free(io_ctx); return NULL; } @@ -1483,8 +1483,8 @@ PHP_FUNCTION(imagecreatefromstring) } if (ZSTR_LEN(data) < sizeof(sig)) { - php_error_docref(NULL, E_WARNING, "Empty string or invalid image"); - RETURN_FALSE; + zend_argument_value_error(1, "cannot be empty"); + RETURN_THROWS(); } memcpy(sig, ZSTR_VAL(data), sizeof(sig)); @@ -1666,7 +1666,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, return; } - php_error_docref(NULL, E_WARNING, "'%s' is not a valid %s file", file, tn); + php_error_docref(NULL, E_WARNING, "\"%s\" is not a valid %s file", file, tn); out_err: php_stream_close(stream); RETURN_FALSE; @@ -1806,7 +1806,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char fp = VCWD_FOPEN(fn, "wb"); if (!fp) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' for writing", fn); + php_error_docref(NULL, E_WARNING, "Unable to open \"%s\" for writing", fn); RETURN_FALSE; } @@ -2297,8 +2297,8 @@ PHP_FUNCTION(imagecolorsforindex) add_assoc_long(return_value,"blue", gdImageBlue(im,col)); add_assoc_long(return_value,"alpha", gdImageAlpha(im,col)); } else { - php_error_docref(NULL, E_WARNING, "Color index %d out of range", col); - RETURN_FALSE; + zend_argument_value_error(2, "is out of range"); + RETURN_THROWS(); } } /* }}} */ diff --git a/ext/gd/tests/001-mb.phpt b/ext/gd/tests/001-mb.phpt index c34c232d0ae70..38bf14a3cb808 100644 --- a/ext/gd/tests/001-mb.phpt +++ b/ext/gd/tests/001-mb.phpt @@ -20,6 +20,6 @@ echo "Done\n"; Warning: imagecreatefrompng(%s001私はガラスを食べられます.test): Failed to open stream: No such file or directory in %s on line %d bool(false) -Warning: imagecreatefrompng(): '%s001私はガラスを食べられます.test' is not a valid PNG file in %s on line %d +Warning: imagecreatefrompng(): "%s001私はガラスを食べられます.test" is not a valid PNG file in %s on line %d bool(false) Done diff --git a/ext/gd/tests/001.phpt b/ext/gd/tests/001.phpt index 75dbcc0d471a3..d741e1f50618d 100644 --- a/ext/gd/tests/001.phpt +++ b/ext/gd/tests/001.phpt @@ -20,6 +20,6 @@ echo "Done\n"; Warning: imagecreatefrompng(%s001.test): Failed to open stream: No such file or directory in %s on line %d bool(false) -Warning: imagecreatefrompng(): '%s001.test' is not a valid PNG file in %s on line %d +Warning: imagecreatefrompng(): "%s001.test" is not a valid PNG file in %s on line %d bool(false) Done diff --git a/ext/gd/tests/bug37346-mb.phpt b/ext/gd/tests/bug37346-mb.phpt index 4ec5734fc7939..e1a9b8b4706c9 100644 --- a/ext/gd/tests/bug37346-mb.phpt +++ b/ext/gd/tests/bug37346-mb.phpt @@ -9,4 +9,4 @@ Bug #37346 (gdimagecreatefromgif, bad colormap) $im = imagecreatefromgif(__DIR__ . '/bug37346私はガラスを食べられます.gif'); ?> --EXPECTF-- -Warning: imagecreatefromgif(): '%sbug37346私はガラスを食べられます.gif' is not a valid GIF file in %sbug37346-mb.php on line %d +Warning: imagecreatefromgif(): "%sbug37346私はガラスを食べられます.gif" is not a valid GIF file in %sbug37346-mb.php on line %d diff --git a/ext/gd/tests/bug37346.phpt b/ext/gd/tests/bug37346.phpt index 57701a7ad7b75..40b3341685daa 100644 --- a/ext/gd/tests/bug37346.phpt +++ b/ext/gd/tests/bug37346.phpt @@ -9,4 +9,4 @@ Bug #37346 (gdimagecreatefromgif, bad colormap) $im = imagecreatefromgif(__DIR__ . '/bug37346.gif'); ?> --EXPECTF-- -Warning: imagecreatefromgif(): '%sbug37346.gif' is not a valid GIF file in %sbug37346.php on line %d +Warning: imagecreatefromgif(): "%sbug37346.gif" is not a valid GIF file in %sbug37346.php on line %d diff --git a/ext/gd/tests/bug37360.phpt b/ext/gd/tests/bug37360.phpt index c2b8b9592dd75..74a58223a96c0 100644 --- a/ext/gd/tests/bug37360.phpt +++ b/ext/gd/tests/bug37360.phpt @@ -10,5 +10,5 @@ $im = imagecreatefromgif(__DIR__ . '/bug37360.gif'); var_dump($im); ?> --EXPECTF-- -Warning: imagecreatefromgif(): '%s' is not a valid GIF file in %s on line %d +Warning: imagecreatefromgif(): "%s" is not a valid GIF file in %s on line %d bool(false) diff --git a/ext/gd/tests/bug38112.phpt b/ext/gd/tests/bug38112.phpt index 8a6911ad9da94..4eb553b614384 100644 --- a/ext/gd/tests/bug38112.phpt +++ b/ext/gd/tests/bug38112.phpt @@ -11,4 +11,4 @@ Bug #38112 (GIF Invalid Code size ). $im = imagecreatefromgif(__DIR__ . '/bug38112.gif'); ?> --EXPECTF-- -Warning: imagecreatefromgif(): '%sbug38112.gif' is not a valid GIF file in %sbug38112.php on line %d +Warning: imagecreatefromgif(): "%sbug38112.gif" is not a valid GIF file in %sbug38112.php on line %d diff --git a/ext/gd/tests/bug39780.phpt b/ext/gd/tests/bug39780.phpt index 2a7af3e0f4982..6468f28b7342d 100644 --- a/ext/gd/tests/bug39780.phpt +++ b/ext/gd/tests/bug39780.phpt @@ -16,5 +16,5 @@ Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncate Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in %s on line %d -Warning: imagecreatefrompng(): '%s' is not a valid PNG file in %s on line %d +Warning: imagecreatefrompng(): "%s" is not a valid PNG file in %s on line %d bool(false) diff --git a/ext/gd/tests/bug39780_extern.phpt b/ext/gd/tests/bug39780_extern.phpt index 0656e52fc7df7..e090477314831 100644 --- a/ext/gd/tests/bug39780_extern.phpt +++ b/ext/gd/tests/bug39780_extern.phpt @@ -14,5 +14,5 @@ var_dump($im); --EXPECTF-- gd-png: fatal libpng error: Read Error: truncated data gd-png error: setjmp returns error condition 2 -Warning: imagecreatefrompng(): '%sbug39780.png' is not a valid PNG file in /%s on line %d +Warning: imagecreatefrompng(): v%sbug39780.png" is not a valid PNG file in /%s on line %d bool(false) diff --git a/ext/gd/tests/bug71912-mb.phpt b/ext/gd/tests/bug71912-mb.phpt index d0bf3a89c235a..32a6ee00bc71b 100644 --- a/ext/gd/tests/bug71912-mb.phpt +++ b/ext/gd/tests/bug71912-mb.phpt @@ -11,5 +11,5 @@ imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . "invalid_neg_size私はガラ ?> OK --EXPECTF-- -Warning: imagecreatefromgd2(): '%s%einvalid_neg_size私はガラスを食べられます.gd2' is not a valid GD2 file in %s%ebug71912-mb.php on line %d +Warning: imagecreatefromgd2(): "%s%einvalid_neg_size私はガラスを食べられます.gd2" is not a valid GD2 file in %s%ebug71912-mb.php on line %d OK diff --git a/ext/gd/tests/bug71912.phpt b/ext/gd/tests/bug71912.phpt index ed4665f439a81..30bde45d214c5 100644 --- a/ext/gd/tests/bug71912.phpt +++ b/ext/gd/tests/bug71912.phpt @@ -14,5 +14,5 @@ imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . "invalid_neg_size.gd2"); ?> OK --EXPECTF-- -Warning: imagecreatefromgd2(): '%s%einvalid_neg_size.gd2' is not a valid GD2 file in %s%ebug71912.php on line %d +Warning: imagecreatefromgd2(): "%s%einvalid_neg_size.gd2" is not a valid GD2 file in %s%ebug71912.php on line %d OK diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt index bd8054cced24b..4baaa92ab21e1 100644 --- a/ext/gd/tests/bug72339.phpt +++ b/ext/gd/tests/bug72339.phpt @@ -35,4 +35,4 @@ unlink($fname); Warning: imagecreatefromgd2(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %sbug72339.php on line %d -Warning: imagecreatefromgd2(): '%sbug72339.gd' is not a valid GD2 file in %sbug72339.php on line %d +Warning: imagecreatefromgd2(): "%sbug72339.gd" is not a valid GD2 file in %sbug72339.php on line %d diff --git a/ext/gd/tests/bug73161.phpt b/ext/gd/tests/bug73161.phpt index bc386dc9c22eb..90fd26274556f 100644 --- a/ext/gd/tests/bug73161.phpt +++ b/ext/gd/tests/bug73161.phpt @@ -12,5 +12,5 @@ $im = imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73161.gd2'); var_dump($im); ?> --EXPECTF-- -Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d +Warning: imagecreatefromgd2(): "%s" is not a valid GD2 file in %s on line %d bool(false) diff --git a/ext/gd/tests/bug73868.phpt b/ext/gd/tests/bug73868.phpt index fd9537c4a017d..ed59ac7be3068 100644 --- a/ext/gd/tests/bug73868.phpt +++ b/ext/gd/tests/bug73868.phpt @@ -12,5 +12,5 @@ var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73868.gd2')); Warning: imagecreatefromgd2(): gd2: EOF while reading in %s on line %d -Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d +Warning: imagecreatefromgd2(): "%s" is not a valid GD2 file in %s on line %d bool(false) diff --git a/ext/gd/tests/bug73869.phpt b/ext/gd/tests/bug73869.phpt index 69c7e1b543902..6adb8c09a4fb1 100644 --- a/ext/gd/tests/bug73869.phpt +++ b/ext/gd/tests/bug73869.phpt @@ -10,8 +10,8 @@ var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869a.gd2')); var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869b.gd2')); ?> --EXPECTF-- -Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d +Warning: imagecreatefromgd2(): "%s" is not a valid GD2 file in %s on line %d bool(false) -Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d +Warning: imagecreatefromgd2(): "%s" is not a valid GD2 file in %s on line %d bool(false) diff --git a/ext/gd/tests/bug75111.phpt b/ext/gd/tests/bug75111.phpt index 4ec22c4a3a17f..e2e13f3b73640 100644 --- a/ext/gd/tests/bug75111.phpt +++ b/ext/gd/tests/bug75111.phpt @@ -17,7 +17,7 @@ $str .= hex2bin("01001800000000000000000000000000000000000000000000000000"); var_dump(imagecreatefromstring($str)); ?> --EXPECTF-- -Warning: imagecreatefromstring(): Passed data is not in 'BMP' format in %s on line %d +Warning: imagecreatefromstring(): Passed data is not in "BMP" format in %s on line %d Warning: imagecreatefromstring(): Couldn't create GD Image Stream out of Data in %s on line %d bool(false) diff --git a/ext/gd/tests/bug75571.phpt b/ext/gd/tests/bug75571.phpt index 10b459d421fea..898f1ecbad5c3 100644 --- a/ext/gd/tests/bug75571.phpt +++ b/ext/gd/tests/bug75571.phpt @@ -9,5 +9,5 @@ if (!extension_loaded('gd')) die('skip gd extension not available'); var_dump(imagecreatefromgif(__DIR__ . '/bug75571.gif')); ?> --EXPECTF-- -Warning: imagecreatefromgif(): '%s' is not a valid GIF file in %s on line %d +Warning: imagecreatefromgif(): "%s" is not a valid GIF file in %s on line %d bool(false) diff --git a/ext/gd/tests/bug77195.phpt b/ext/gd/tests/bug77195.phpt index f90035b7416be..fc788a6667574 100644 --- a/ext/gd/tests/bug77195.phpt +++ b/ext/gd/tests/bug77195.phpt @@ -14,4 +14,4 @@ imagecreatefromjpeg($filename); --EXPECTF-- Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: JPEG datastream contains no image in %s on line %d -Warning: imagecreatefromjpeg(): '%s' is not a valid JPEG file in %s on line %d +Warning: imagecreatefromjpeg(): "%s" is not a valid JPEG file in %s on line %d diff --git a/ext/gd/tests/bug77973.phpt b/ext/gd/tests/bug77973.phpt index c9400987e07a6..434cc4449e1a4 100644 --- a/ext/gd/tests/bug77973.phpt +++ b/ext/gd/tests/bug77973.phpt @@ -16,7 +16,7 @@ var_dump($im); --EXPECTF-- Warning: imagecreatefromxbm(): Invalid XBM in %s on line %d -Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d +Warning: imagecreatefromxbm(): "%s" is not a valid XBM file in %s on line %d bool(false) --CLEAN-- getMessage() . "\n"; +} imagedestroy($im); $im = imagecreate(5,5); @@ -48,7 +52,11 @@ imagedestroy($im); $im = imagecreate(5,5); $c = imagecolorclosestalpha($im, 255,0,255,100); -print_r(imagecolorsforindex($im, $c)); +try { + imagecolorsforindex($im, $c); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} imagedestroy($im); $im = imagecreate(5,5); @@ -62,7 +70,6 @@ for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1); $c = imagecolorclosestalpha($im, 255,0,0,1); print_r(imagecolorsforindex($im, $c)); - $im = imagecreate(5,5); for ($i=0; $i<256; $i++) { if ($i == 246) { @@ -74,12 +81,10 @@ for ($i=0; $i<256; $i++) { $c = imagecolorclosestalpha($im, 255,10,10,1); print_r(imagecolorsforindex($im, $c)); - ?> ---EXPECTF-- +--EXPECT-- FF00FF - -Warning: imagecolorsforindex(): Color index -1 out of range in %s on line %d +imagecolorsforindex(): Argument #2 ($index) is out of range Array ( [red] => 255 @@ -102,8 +107,7 @@ Array [alpha] => 0 ) 64FF00FF - -Warning: imagecolorsforindex(): Color index -1 out of range in %s on line %d +imagecolorsforindex(): Argument #2 ($index) is out of range Array ( [red] => 255 diff --git a/ext/gd/tests/colormatch.phpt b/ext/gd/tests/colormatch.phpt index 283a200571919..5641bc01017fe 100644 --- a/ext/gd/tests/colormatch.phpt +++ b/ext/gd/tests/colormatch.phpt @@ -10,12 +10,16 @@ imagecolormatch $im = imagecreatetruecolor(5,5); $im2 = imagecreate(5,5); -imagecolormatch($im, $im2); +try { + imagecolormatch($im, $im2); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} echo "ok\n"; imagedestroy($im); ?> ---EXPECTF-- -Warning: imagecolormatch(): Image2 must have at least one color in %s on line %d +--EXPECT-- +imagecolormatch(): Argument #2 ($im2) must have at least one color ok diff --git a/ext/gd/tests/crafted_gd2.phpt b/ext/gd/tests/crafted_gd2.phpt index 60687dfa3c38a..a5b0dfe339bba 100644 --- a/ext/gd/tests/crafted_gd2.phpt +++ b/ext/gd/tests/crafted_gd2.phpt @@ -11,4 +11,4 @@ Test max colors for a gd image. imagecreatefromgd(__DIR__ . '/crafted.gd2'); ?> --EXPECTF-- -Warning: imagecreatefromgd(): '%scrafted.gd2' is not a valid GD file in %s on line %d +Warning: imagecreatefromgd(): "%scrafted.gd2" is not a valid GD file in %s on line %d diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt index 5d14708a2ee32..d4d63149f13f1 100644 --- a/ext/gd/tests/createfromstring.phpt +++ b/ext/gd/tests/createfromstring.phpt @@ -51,14 +51,17 @@ unlink($dir . '/p.png'); //empty string -$im = imagecreatefromstring(''); +try { + imagecreatefromstring(''); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} //random string > 12 $im = imagecreatefromstring(' asdf jklp foo'); ?> --EXPECTF-- createfromstring truecolor png: ok createfromstring palette png: ok - -Warning: imagecreatefromstring(): Empty string or invalid image in %screatefromstring.php on line %d +imagecreatefromstring(): Argument #1 ($image) cannot be empty Warning: imagecreatefromstring(): Data is not in a recognized format in %screatefromstring.php on line %d diff --git a/ext/gd/tests/createfromwbmp2.phpt b/ext/gd/tests/createfromwbmp2.phpt index f75d02613d328..c6a1a22427d6a 100644 --- a/ext/gd/tests/createfromwbmp2.phpt +++ b/ext/gd/tests/createfromwbmp2.phpt @@ -45,4 +45,4 @@ unlink($filename); Warning: imagecreatefromwbmp(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %s on line %d -Warning: imagecreatefromwbmp(): '%s' is not a valid WBMP file in %s on line %d +Warning: imagecreatefromwbmp(): "%s" is not a valid WBMP file in %s on line %d diff --git a/ext/gd/tests/createfromwbmp2_extern.phpt b/ext/gd/tests/createfromwbmp2_extern.phpt index ad7a130c18df4..ab15ec024e7e7 100644 --- a/ext/gd/tests/createfromwbmp2_extern.phpt +++ b/ext/gd/tests/createfromwbmp2_extern.phpt @@ -44,4 +44,4 @@ unlink($filename); --EXPECTF-- gd warning: Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully -Warning: imagecreatefromwbmp(): '%s_tmp.wbmp' is not a valid WBMP file in %s on line %d +Warning: imagecreatefromwbmp(): "%s_tmp.wbmp" is not a valid WBMP file in %s on line %d diff --git a/ext/gd/tests/imagecolormatch_error2.phpt b/ext/gd/tests/imagecolormatch_error2.phpt index 2240f987df5f2..f356b716c6147 100644 --- a/ext/gd/tests/imagecolormatch_error2.phpt +++ b/ext/gd/tests/imagecolormatch_error2.phpt @@ -13,8 +13,13 @@ $ima = imagecreate(110, 20); $background_color = imagecolorallocate($ima, 0, 0, 0); $imb = imagecreate(110, 20); $background_color = imagecolorallocate($imb, 0, 0, 100); -var_dump(imagecolormatch($ima, $imb)); + +try { + imagecolormatch($ima, $imb); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + ?> ---EXPECTF-- -Warning: imagecolormatch(): Image1 must be TrueColor in %s on line %d -bool(false) +--EXPECT-- +imagecolormatch(): Argument #1 ($im1) must be TrueColor diff --git a/ext/gd/tests/imagecolormatch_error3.phpt b/ext/gd/tests/imagecolormatch_error3.phpt index 245ebca646d03..a3f556a3e12ba 100644 --- a/ext/gd/tests/imagecolormatch_error3.phpt +++ b/ext/gd/tests/imagecolormatch_error3.phpt @@ -13,8 +13,13 @@ $ima = imagecreatetruecolor(110, 20); $background_color = imagecolorallocate($ima, 0, 0, 0); $imb = imagecreatetruecolor(110, 20); $background_color = imagecolorallocate($imb, 0, 0, 100); -var_dump(imagecolormatch($ima, $imb)); + +try { + imagecolormatch($ima, $imb); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + ?> ---EXPECTF-- -Warning: imagecolormatch(): Image2 must be Palette in %s on line %d -bool(false) +--EXPECT-- +imagecolormatch(): Argument #2 ($im2) must be Palette diff --git a/ext/gd/tests/imagecolormatch_error4.phpt b/ext/gd/tests/imagecolormatch_error4.phpt index 4579192571a24..f1392c9149e90 100644 --- a/ext/gd/tests/imagecolormatch_error4.phpt +++ b/ext/gd/tests/imagecolormatch_error4.phpt @@ -13,8 +13,13 @@ $ima = imagecreatetruecolor(110, 20); $background_color = imagecolorallocate($ima, 0, 0, 0); $imb = imagecreate(100, 20); $background_color = imagecolorallocate($imb, 0, 0, 100); -var_dump(imagecolormatch($ima, $imb)); + +try { + imagecolormatch($ima, $imb); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + ?> ---EXPECTF-- -Warning: imagecolormatch(): Image1 and Image2 must be the same size in %s on line %d -bool(false) +--EXPECT-- +imagecolormatch(): Argument #2 ($im2) must be the same size as argument #1 ($im1) diff --git a/ext/gd/tests/libgd00086.phpt b/ext/gd/tests/libgd00086.phpt index c7954a0a002da..959828f0685ac 100644 --- a/ext/gd/tests/libgd00086.phpt +++ b/ext/gd/tests/libgd00086.phpt @@ -16,5 +16,5 @@ Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncate Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in %s on line %d -Warning: imagecreatefrompng(): '%s' is not a valid PNG file in %s on line %d +Warning: imagecreatefrompng(): "%s" is not a valid PNG file in %s on line %d bool(false) diff --git a/ext/gd/tests/libgd00086_extern.phpt b/ext/gd/tests/libgd00086_extern.phpt index 36b79b4835fb4..78bafa761e88b 100644 --- a/ext/gd/tests/libgd00086_extern.phpt +++ b/ext/gd/tests/libgd00086_extern.phpt @@ -15,5 +15,5 @@ var_dump($im); gd-png: fatal libpng error: Read Error: truncated data gd-png error: setjmp returns error condition 1 -Warning: imagecreatefrompng(): '%slibgd00086.png' is not a valid PNG file in %s on line %d +Warning: imagecreatefrompng(): "%slibgd00086.png" is not a valid PNG file in %s on line %d bool(false) diff --git a/ext/gd/tests/libgd00094-mb.phpt b/ext/gd/tests/libgd00094-mb.phpt index 76b6bcd5663cf..7ce24a43b22c2 100644 --- a/ext/gd/tests/libgd00094-mb.phpt +++ b/ext/gd/tests/libgd00094-mb.phpt @@ -11,5 +11,5 @@ $im = imagecreatefromxbm(__DIR__ . '/libgd00094私はガラスを食べられま var_dump($im); ?> --EXPECTF-- -Warning: imagecreatefromxbm(): '%slibgd00094私はガラスを食べられます.xbm' is not a valid XBM file in %slibgd00094-mb.php on line %d +Warning: imagecreatefromxbm(): "%slibgd00094私はガラスを食べられます.xbm" is not a valid XBM file in %slibgd00094-mb.php on line %d bool(false) diff --git a/ext/gd/tests/libgd00094.phpt b/ext/gd/tests/libgd00094.phpt index 17c4df70d56da..8af0b342d97c0 100644 --- a/ext/gd/tests/libgd00094.phpt +++ b/ext/gd/tests/libgd00094.phpt @@ -11,5 +11,5 @@ $im = imagecreatefromxbm(__DIR__ . '/libgd00094.xbm'); var_dump($im); ?> --EXPECTF-- -Warning: imagecreatefromxbm(): '%slibgd00094.xbm' is not a valid XBM file in %slibgd00094.php on line %d +Warning: imagecreatefromxbm(): "%slibgd00094.xbm" is not a valid XBM file in %slibgd00094.php on line %d bool(false) diff --git a/ext/gd/tests/libgd00101.phpt b/ext/gd/tests/libgd00101.phpt index 7e1e4b587219c..d2e278ced9888 100644 --- a/ext/gd/tests/libgd00101.phpt +++ b/ext/gd/tests/libgd00101.phpt @@ -14,5 +14,5 @@ var_dump($im); Warning: imagecreatefromgd(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %slibgd00101.php on line %d -Warning: imagecreatefromgd(): '%slibgd00101.gd' is not a valid GD file in %slibgd00101.php on line %d +Warning: imagecreatefromgd(): "%slibgd00101.gd" is not a valid GD file in %slibgd00101.php on line %d bool(false)