[php-src] master: ext/gd: applied fixers to improve test robustness (#23132)
NickSdot via GitHub <[email protected]>
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: LamentXU123
Date: 2026-08-14T17:21:47+08:00
Commit: https://github.com/php/php-src/commit/4ba23348c8f582adb42298bfbb6a23469afc8939
Raw diff: https://github.com/php/php-src/commit/4ba23348c8f582adb42298bfbb6a23469afc8939.diff
ext/gd: applied fixers to improve test robustness (#23132)
Changed paths:
M ext/gd/tests/avif_decode_encode.phpt
M ext/gd/tests/bug66356.phpt
M ext/gd/tests/bug72337.phpt
M ext/gd/tests/bug72709.phpt
M ext/gd/tests/bug73957.phpt
M ext/gd/tests/bug81739.phpt
M ext/gd/tests/colorclosest.phpt
M ext/gd/tests/colormatch.phpt
M ext/gd/tests/createfromstring.phpt
M ext/gd/tests/gdimage_prevent_cloning.phpt
M ext/gd/tests/gh16255.phpt
M ext/gd/tests/gh16260.phpt
M ext/gd/tests/gh16322.phpt
M ext/gd/tests/gh17703.phpt
M ext/gd/tests/gh18005.phpt
M ext/gd/tests/gh18243.phpt
M ext/gd/tests/gh19578.phpt
M ext/gd/tests/gh20551.phpt
M ext/gd/tests/gh20602.phpt
M ext/gd/tests/gh8848.phpt
M ext/gd/tests/imagebmp_nullbyte_injection.phpt
M ext/gd/tests/imagecolormatch_error2.phpt
M ext/gd/tests/imagecolormatch_error3.phpt
M ext/gd/tests/imagecolormatch_error4.phpt
M ext/gd/tests/imagecrop_overflow.phpt
M ext/gd/tests/imagefilter2.phpt
M ext/gd/tests/imagefilter_error1.phpt
M ext/gd/tests/imagegd2_nullbyte_injection.phpt
M ext/gd/tests/imagegd_nullbyte_injection.phpt
M ext/gd/tests/imagegif_nullbyte_injection.phpt
M ext/gd/tests/imagejpeg_nullbyte_injection.phpt
M ext/gd/tests/imagepng_nullbyte_injection.phpt
M ext/gd/tests/imageresolution_basic.phpt
M ext/gd/tests/imageresolution_jpeg.phpt
M ext/gd/tests/imagewbmp_nullbyte_injection.phpt
M ext/gd/tests/imagewebp_nullbyte_injection.phpt
M ext/gd/tests/imagexbm_nullbyte_injection.phpt
M ext/gd/tests/pngcomp.phpt
M ext/gd/tests/webp_basic.phpt
Diff:
diff --git a/ext/gd/tests/avif_decode_encode.phpt b/ext/gd/tests/avif_decode_encode.phpt
index 054eb5246763..d412309bc18e 100644
--- a/ext/gd/tests/avif_decode_encode.phpt
+++ b/ext/gd/tests/avif_decode_encode.phpt
@@ -39,7 +39,7 @@ gd
try {
imageavif($img, $outfile, 1234);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
echo 'Encoding AVIF with illegal speed: ';
@@ -47,7 +47,7 @@ gd
try {
imageavif($img, $outfile, 70, 1234);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
echo 'Encoding AVIF losslessly... ';
@@ -75,8 +75,8 @@ Default AVIF encoding: ok
Encoding AVIF at quality 70: ok
Encoding AVIF at quality 70 with speed 5: ok
Encoding AVIF with default quality: ok
-Encoding AVIF with illegal quality: imageavif(): Argument #3 ($quality) must be between -1 and 100
-Encoding AVIF with illegal speed: imageavif(): Argument #4 ($speed) must be between -1 and 10
+Encoding AVIF with illegal quality: ValueError: imageavif(): Argument #3 ($quality) must be between -1 and 100
+Encoding AVIF with illegal speed: ValueError: imageavif(): Argument #4 ($speed) must be between -1 and 10
Encoding AVIF losslessly... ok
Decoding the AVIF we just wrote...
What is the mean squared error of the two images? 0
diff --git a/ext/gd/tests/bug66356.phpt b/ext/gd/tests/bug66356.phpt
index 616a270115c1..b82eb03958d5 100644
--- a/ext/gd/tests/bug66356.phpt
+++ b/ext/gd/tests/bug66356.phpt
@@ -13,7 +13,7 @@ $arr = array("x" => 2147483647, "y" => 2147483647, "width" => 10, "height" => 10
try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
print_r($arr);
@@ -32,7 +32,7 @@ var_dump(imagecrop($img, array("x" => 0, "y" => 0, "width" => 65535, "height" =>
--EXPECTF--
object(GdImage)#2 (0) {
}
-imagecrop(): Argument #2 ($rectangle) overflow with "x" and "width" keys
+ValueError: imagecrop(): Argument #2 ($rectangle) overflow with "x" and "width" keys
Array
(
[x] => 2147483647
diff --git a/ext/gd/tests/bug72337.phpt b/ext/gd/tests/bug72337.phpt
index a15fa349304e..4973b39eb286 100644
--- a/ext/gd/tests/bug72337.phpt
+++ b/ext/gd/tests/bug72337.phpt
@@ -8,23 +8,23 @@ $im = imagecreatetruecolor(1, 1);
try {
imagescale($im, 1, 1, -10);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagescale($im, 0, 1, 0);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagescale($im, 1, 0, 0);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
imagescale($im, 1, 1, IMG_BICUBIC_FIXED);
echo "OK";
?>
--EXPECT--
-imagescale(): Argument #4 ($mode) must be one of the GD_* constants
-imagescale(): Argument #2 ($width) must be between 1 and 2147483647
-imagescale(): Argument #3 ($height) must be between 1 and 2147483647
+ValueError: imagescale(): Argument #4 ($mode) must be one of the GD_* constants
+ValueError: imagescale(): Argument #2 ($width) must be between 1 and 2147483647
+ValueError: imagescale(): Argument #3 ($height) must be between 1 and 2147483647
OK
diff --git a/ext/gd/tests/bug72709.phpt b/ext/gd/tests/bug72709.phpt
index bc20d1bf58b8..7d9e34ecdabf 100644
--- a/ext/gd/tests/bug72709.phpt
+++ b/ext/gd/tests/bug72709.phpt
@@ -10,12 +10,12 @@ try {
var_dump(imagesetstyle($im, array()));
}
catch (\Error $ex) {
- echo $ex->getMessage() . "\n";
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
?>
====DONE====
--EXPECT--
-imagesetstyle(): Argument #2 ($style) must not be empty
+ValueError: imagesetstyle(): Argument #2 ($style) must not be empty
====DONE====
diff --git a/ext/gd/tests/bug73957.phpt b/ext/gd/tests/bug73957.phpt
index 067d71674eb2..986adafa0767 100644
--- a/ext/gd/tests/bug73957.phpt
+++ b/ext/gd/tests/bug73957.phpt
@@ -15,8 +15,8 @@ try {
// which is not supposed to happen
var_dump(imagesx($im));
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
-imagescale(): Argument #2 ($width) must be between 1 and %d
+ValueError: imagescale(): Argument #2 ($width) must be between 1 and %d
diff --git a/ext/gd/tests/bug81739.phpt b/ext/gd/tests/bug81739.phpt
index b340aa7c0758..c7f6a4054bf4 100644
--- a/ext/gd/tests/bug81739.phpt
+++ b/ext/gd/tests/bug81739.phpt
@@ -19,4 +19,4 @@ Warning: imageloadfont(): %croduct of memory allocation multiplication would exc
in %s on line %d
Warning: imageloadfont(): Error reading font, invalid font header in %s on line %d
-bool(false)
\ No newline at end of file
+bool(false)
diff --git a/ext/gd/tests/colorclosest.phpt b/ext/gd/tests/colorclosest.phpt
index 8cfcbdcdea4e..2a1898304613 100644
--- a/ext/gd/tests/colorclosest.phpt
+++ b/ext/gd/tests/colorclosest.phpt
@@ -15,7 +15,7 @@ $c = imagecolorclosest($im, 255,0,255);
try {
imagecolorsforindex($im, $c);
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
$im = null;
@@ -53,7 +53,7 @@ $c = imagecolorclosestalpha($im, 255,0,255,100);
try {
imagecolorsforindex($im, $c);
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
$im = null;
@@ -82,7 +82,7 @@ print_r(imagecolorsforindex($im, $c));
?>
--EXPECT--
FF00FF
-imagecolorsforindex(): Argument #2 ($color) is out of range
+ValueError: imagecolorsforindex(): Argument #2 ($color) is out of range
Array
(
[red] => 255
@@ -105,7 +105,7 @@ Array
[alpha] => 0
)
64FF00FF
-imagecolorsforindex(): Argument #2 ($color) is out of range
+ValueError: imagecolorsforindex(): Argument #2 ($color) is out of range
Array
(
[red] => 255
diff --git a/ext/gd/tests/colormatch.phpt b/ext/gd/tests/colormatch.phpt
index fe22784c9942..a2def011c481 100644
--- a/ext/gd/tests/colormatch.phpt
+++ b/ext/gd/tests/colormatch.phpt
@@ -11,11 +11,11 @@ $im2 = imagecreate(5,5);
try {
imagecolormatch($im, $im2);
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
echo "ok\n";
?>
--EXPECT--
-imagecolormatch(): Argument #2 ($image2) must have at least one color
+ValueError: imagecolormatch(): Argument #2 ($image2) must have at least one color
ok
diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt
index ce90b368f2e7..569fc0dd41be 100644
--- a/ext/gd/tests/createfromstring.phpt
+++ b/ext/gd/tests/createfromstring.phpt
@@ -55,7 +55,7 @@ unlink($dir . '/p.png');
try {
imagecreatefromstring('');
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
//random string > 12
$im = imagecreatefromstring(' asdf jklp foo');
diff --git a/ext/gd/tests/gdimage_prevent_cloning.phpt b/ext/gd/tests/gdimage_prevent_cloning.phpt
index 609e6f99bbfa..22a4120be0bc 100644
--- a/ext/gd/tests/gdimage_prevent_cloning.phpt
+++ b/ext/gd/tests/gdimage_prevent_cloning.phpt
@@ -9,7 +9,7 @@ try {
$img_src = imagecreatetruecolor(32, 32);
$img_dst = clone $img_src;
} catch (Throwable $e) {
- echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
diff --git a/ext/gd/tests/gh16255.phpt b/ext/gd/tests/gh16255.phpt
index 147dc5adf377..c255f1027e37 100644
--- a/ext/gd/tests/gh16255.phpt
+++ b/ext/gd/tests/gh16255.phpt
@@ -12,23 +12,23 @@ $im = imagecreatetruecolor(40, 40);
try {
imageconvolution($im, $matrix, NAN, 1.0);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
imageconvolution($im, $matrix, 2.225E-307, 1.0);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
imageconvolution($im, $matrix, 1, NAN);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imageconvolution(): Argument #3 ($divisor) must be finite
-imageconvolution(): Argument #3 ($divisor) must not be 0
-imageconvolution(): Argument #4 ($offset) must be finite
+ValueError: imageconvolution(): Argument #3 ($divisor) must be finite
+ValueError: imageconvolution(): Argument #3 ($divisor) must not be 0
+ValueError: imageconvolution(): Argument #4 ($offset) must be finite
diff --git a/ext/gd/tests/gh16260.phpt b/ext/gd/tests/gh16260.phpt
index 563fc8d16278..57daf82b387d 100644
--- a/ext/gd/tests/gh16260.phpt
+++ b/ext/gd/tests/gh16260.phpt
@@ -9,14 +9,14 @@ $im = imagecreatetruecolor(10,10);
try {
imagerotate($im, PHP_INT_MIN, 0);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagerotate($im, PHP_INT_MAX, 0);
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
--EXPECTF--
-imagerotate(): Argument #2 ($angle) must be between %s and %s
-imagerotate(): Argument #2 ($angle) must be between %s and %s
+ValueError: imagerotate(): Argument #2 ($angle) must be between %s and %s
+ValueError: imagerotate(): Argument #2 ($angle) must be between %s and %s
diff --git a/ext/gd/tests/gh16322.phpt b/ext/gd/tests/gh16322.phpt
index 1e5ab2f3a6b1..abe6846b1726 100644
--- a/ext/gd/tests/gh16322.phpt
+++ b/ext/gd/tests/gh16322.phpt
@@ -10,16 +10,16 @@ $src = imagecreatetruecolor(8, 8);
try {
imageaffine($src, $matrix);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$matrix[0] = 1;
$matrix[3] = -INF;
try {
imageaffine($src, $matrix);
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
-imageaffine(): Argument #2 ($affine) element 0 must be between %s and %d
-imageaffine(): Argument #2 ($affine) element 3 must be between %s and %d
+ValueError: imageaffine(): Argument #2 ($affine) element 0 must be between %s and %d
+ValueError: imageaffine(): Argument #2 ($affine) element 3 must be between %s and %d
diff --git a/ext/gd/tests/gh17703.phpt b/ext/gd/tests/gh17703.phpt
index 4677b6a50139..9d9145f30e0c 100644
--- a/ext/gd/tests/gh17703.phpt
+++ b/ext/gd/tests/gh17703.phpt
@@ -10,8 +10,8 @@ $img = imagecreatetruecolor ( 256, 1);
try {
imagescale($img, -1, -1, 0);
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Argument #2 ($width) and argument #3 ($height) cannot be both negative
+ValueError: Argument #2 ($width) and argument #3 ($height) cannot be both negative
diff --git a/ext/gd/tests/gh18005.phpt b/ext/gd/tests/gh18005.phpt
index 5282c0be0268..e36d2efa2cd6 100644
--- a/ext/gd/tests/gh18005.phpt
+++ b/ext/gd/tests/gh18005.phpt
@@ -13,80 +13,80 @@ $img = imagecreatetruecolor(1, 1);
try {
imagesetstyle($img, [0, new A()]);
} catch (\TypeError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagesetstyle($img, [0, PHP_INT_MIN]);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagefilter($img, IMG_FILTER_SCATTER, 0, 0, [new A()]);
} catch (\TypeError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagefilter($img, IMG_FILTER_SCATTER, 0, 0, [-1]);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => PHP_INT_MIN, "y" => 0, "width" => 0, "height" => 0]);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => 0, "y" => PHP_INT_MIN, "width" => 0, "height" => 0]);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => 0, "y" => 0, "width" => PHP_INT_MAX, "height" => 0]);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => 0, "y" => 0, "width" => 0, "height" => PHP_INT_MAX]);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => new A(), "y" => 0, "width" => 0, "height" => 0]);
} catch (\TypeError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => 0, "y" => new A(), "width" => 0, "height" => 0]);
} catch (\TypeError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => 0, "y" => 0, "width" => new A(), "height" => 0]);
} catch (\TypeError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagecrop($img, ["x" => 0, "y" => 0, "width" => 0, "height" => new A()]);
} catch (\TypeError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$one = 1;
var_dump(imagecrop($img, ["x" => &$one, "y" => &$one, "width" => &$one, "height" => &$one]));
?>
--EXPECTF--
-imagesetstyle(): Argument #2 ($style) must only have elements of type int, A given
-imagesetstyle(): Argument #2 ($style) elements must be between %i and %d
-imagefilter(): Argument #5 must be of type int, A given
-imagefilter(): Argument #5 value must be between 0 and 2147483647
-imagecrop(): Argument #2 ($rectangle) "x" key must be between %i and %d
-imagecrop(): Argument #2 ($rectangle) "y" key must be between %i and %d
-imagecrop(): Argument #2 ($rectangle) "width" key must be between %i and %d
-imagecrop(): Argument #2 ($rectangle) "height" key must be between %i and %d
-imagecrop(): Argument #2 ($rectangle) "x" key must be of type int, A given
-imagecrop(): Argument #2 ($rectangle) "y" key must be of type int, A given
-imagecrop(): Argument #2 ($rectangle) "width" key must be of type int, A given
-imagecrop(): Argument #2 ($rectangle) "height" key must be of type int, A given
+TypeError: imagesetstyle(): Argument #2 ($style) must only have elements of type int, A given
+ValueError: imagesetstyle(): Argument #2 ($style) elements must be between %i and %d
+TypeError: imagefilter(): Argument #5 must be of type int, A given
+ValueError: imagefilter(): Argument #5 value must be between 0 and 2147483647
+ValueError: imagecrop(): Argument #2 ($rectangle) "x" key must be between %i and %d
+ValueError: imagecrop(): Argument #2 ($rectangle) "y" key must be between %i and %d
+ValueError: imagecrop(): Argument #2 ($rectangle) "width" key must be between %i and %d
+ValueError: imagecrop(): Argument #2 ($rectangle) "height" key must be between %i and %d
+TypeError: imagecrop(): Argument #2 ($rectangle) "x" key must be of type int, A given
+TypeError: imagecrop(): Argument #2 ($rectangle) "y" key must be of type int, A given
+TypeError: imagecrop(): Argument #2 ($rectangle) "width" key must be of type int, A given
+TypeError: imagecrop(): Argument #2 ($rectangle) "height" key must be of type int, A given
object(GdImage)#2 (0) {
}
diff --git a/ext/gd/tests/gh18243.phpt b/ext/gd/tests/gh18243.phpt
index 3235098a3dcc..00698add614c 100644
--- a/ext/gd/tests/gh18243.phpt
+++ b/ext/gd/tests/gh18243.phpt
@@ -14,29 +14,29 @@ $im = imagecreatetruecolor(100, 80);
try {
imagettftext($im, PHP_INT_MAX, 0, 15, 60, 0, $font, "");
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagettftext($im, PHP_INT_MIN, 0, 15, 60, 0, $font, "");
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagettftext($im, NAN, 0, 15, 60, 0, $font, "");
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagettftext($im, INF, 0, 15, 60, 0, $font, "");
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
-imagettftext(): Argument #2 ($size) must be between %i and %d
-imagettftext(): Argument #2 ($size) must be between %i and %d
-imagettftext(): Argument #2 ($size) must be finite
-imagettftext(): Argument #2 ($size) must be between %i and %d
+ValueError: imagettftext(): Argument #2 ($size) must be between %i and %d
+ValueError: imagettftext(): Argument #2 ($size) must be between %i and %d
+ValueError: imagettftext(): Argument #2 ($size) must be finite
+ValueError: imagettftext(): Argument #2 ($size) must be between %i and %d
diff --git a/ext/gd/tests/gh19578.phpt b/ext/gd/tests/gh19578.phpt
index 15d10f752d0d..cc13c6467921 100644
--- a/ext/gd/tests/gh19578.phpt
+++ b/ext/gd/tests/gh19578.phpt
@@ -13,15 +13,15 @@ $src = imagecreatetruecolor(255, 255);
try {
imagefilledellipse($src, 0, 0, PHP_INT_MAX, 254, 0);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagefilledellipse($src, 0, 0, -16, 254, 0);
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
-imagefilledellipse(): Argument #4 ($width) must be between 0 and %d
-imagefilledellipse(): Argument #4 ($width) must be between 0 and %d
+ValueError: imagefilledellipse(): Argument #4 ($width) must be between 0 and %d
+ValueError: imagefilledellipse(): Argument #4 ($width) must be between 0 and %d
diff --git a/ext/gd/tests/gh20551.phpt b/ext/gd/tests/gh20551.phpt
index 32ca50ca5f62..04a62a256df2 100644
--- a/ext/gd/tests/gh20551.phpt
+++ b/ext/gd/tests/gh20551.phpt
@@ -21,16 +21,16 @@ foreach ($gammas as $gamma) {
try {
imagegammacorrect($im, $gamma[0], $gamma[1]);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
}
?>
--EXPECT--
-imagegammacorrect(): Argument #2 ($input_gamma) must be finite
-imagegammacorrect(): Argument #2 ($input_gamma) must be finite
-imagegammacorrect(): Argument #2 ($input_gamma) must be finite
-imagegammacorrect(): Argument #2 ($input_gamma) must be greater than 0
-imagegammacorrect(): Argument #3 ($output_gamma) must be finite
-imagegammacorrect(): Argument #3 ($output_gamma) must be finite
-imagegammacorrect(): Argument #3 ($output_gamma) must be finite
-imagegammacorrect(): Argument #3 ($output_gamma) must be greater than 0
+ValueError: imagegammacorrect(): Argument #2 ($input_gamma) must be finite
+ValueError: imagegammacorrect(): Argument #2 ($input_gamma) must be finite
+ValueError: imagegammacorrect(): Argument #2 ($input_gamma) must be finite
+ValueError: imagegammacorrect(): Argument #2 ($input_gamma) must be greater than 0
+ValueError: imagegammacorrect(): Argument #3 ($output_gamma) must be finite
+ValueError: imagegammacorrect(): Argument #3 ($output_gamma) must be finite
+ValueError: imagegammacorrect(): Argument #3 ($output_gamma) must be finite
+ValueError: imagegammacorrect(): Argument #3 ($output_gamma) must be greater than 0
diff --git a/ext/gd/tests/gh20602.phpt b/ext/gd/tests/gh20602.phpt
index 29c781e76a2d..b481b32ae9b6 100644
--- a/ext/gd/tests/gh20602.phpt
+++ b/ext/gd/tests/gh20602.phpt
@@ -9,14 +9,14 @@ $im = imagecreatetruecolor(16, 16);
try {
imagescale($im, PHP_INT_MAX, -1);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagescale($im, -1, PHP_INT_MAX);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
-imagescale(): Argument #2 ($width) must be less than or equal to %d
-imagescale(): Argument #3 ($height) must be less than or equal to %d
+ValueError: imagescale(): Argument #2 ($width) must be less than or equal to %d
+ValueError: imagescale(): Argument #3 ($height) must be less than or equal to %d
diff --git a/ext/gd/tests/gh8848.phpt b/ext/gd/tests/gh8848.phpt
index 0e18b64babb3..324307f55966 100644
--- a/ext/gd/tests/gh8848.phpt
+++ b/ext/gd/tests/gh8848.phpt
@@ -18,12 +18,12 @@ foreach ($argslist as $args) {
try {
imagecopyresized($image1, $image2, 1, 1, 1, 1, ...$args);
} catch (ValueError $ex) {
- echo $ex->getMessage(), PHP_EOL;
+ echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
}
}
?>
--EXPECT--
-imagecopyresized(): Argument #7 ($dst_width) must be greater than 0
-imagecopyresized(): Argument #8 ($dst_height) must be greater than 0
-imagecopyresized(): Argument #9 ($src_width) must be greater than 0
-imagecopyresized(): Argument #10 ($src_height) must be greater than 0
+ValueError: imagecopyresized(): Argument #7 ($dst_width) must be greater than 0
+ValueError: imagecopyresized(): Argument #8 ($dst_height) must be greater than 0
+ValueError: imagecopyresized(): Argument #9 ($src_width) must be greater than 0
+ValueError: imagecopyresized(): Argument #10 ($src_height) must be greater than 0
diff --git a/ext/gd/tests/imagebmp_nullbyte_injection.phpt b/ext/gd/tests/imagebmp_nullbyte_injection.phpt
index 81a3e40d7c27..2fe4aa9b34eb 100644
--- a/ext/gd/tests/imagebmp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagebmp_nullbyte_injection.phpt
@@ -12,8 +12,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagebmp($image, "./foo\0bar");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagebmp(): Argument #2 ($file) must not contain null bytes
+TypeError: imagebmp(): Argument #2 ($file) must not contain null bytes
diff --git a/ext/gd/tests/imagecolormatch_error2.phpt b/ext/gd/tests/imagecolormatch_error2.phpt
index 5af039a785dd..c2cdc0b91580 100644
--- a/ext/gd/tests/imagecolormatch_error2.phpt
+++ b/ext/gd/tests/imagecolormatch_error2.phpt
@@ -15,9 +15,9 @@ $background_color = imagecolorallocate($imb, 0, 0, 100);
try {
imagecolormatch($ima, $imb);
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-imagecolormatch(): Argument #1 ($image1) must be TrueColor
+ValueError: imagecolormatch(): Argument #1 ($image1) must be TrueColor
diff --git a/ext/gd/tests/imagecolormatch_error3.phpt b/ext/gd/tests/imagecolormatch_error3.phpt
index 9b0d4c8830c7..02101585b979 100644
--- a/ext/gd/tests/imagecolormatch_error3.phpt
+++ b/ext/gd/tests/imagecolormatch_error3.phpt
@@ -15,9 +15,9 @@ $background_color = imagecolorallocate($imb, 0, 0, 100);
try {
imagecolormatch($ima, $imb);
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-imagecolormatch(): Argument #2 ($image2) must be Palette
+ValueError: imagecolormatch(): Argument #2 ($image2) must be Palette
diff --git a/ext/gd/tests/imagecolormatch_error4.phpt b/ext/gd/tests/imagecolormatch_error4.phpt
index e4aa04ca3d37..2c117dcd46ab 100644
--- a/ext/gd/tests/imagecolormatch_error4.phpt
+++ b/ext/gd/tests/imagecolormatch_error4.phpt
@@ -15,9 +15,9 @@ $background_color = imagecolorallocate($imb, 0, 0, 100);
try {
imagecolormatch($ima, $imb);
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-imagecolormatch(): Argument #2 ($image2) must be the same size as argument #1 ($im1)
+ValueError: imagecolormatch(): Argument #2 ($image2) must be the same size as argument #1 ($im1)
diff --git a/ext/gd/tests/imagecrop_overflow.phpt b/ext/gd/tests/imagecrop_overflow.phpt
index 3331a6267168..4edfb985ae95 100644
--- a/ext/gd/tests/imagecrop_overflow.phpt
+++ b/ext/gd/tests/imagecrop_overflow.phpt
@@ -11,7 +11,7 @@ $arr = ["x" => 2147483647, "y" => 2147483647, "width" => 10, "height" => 10];
try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$arr = ["x" => -2147483648, "y" => 0, "width" => -10, "height" => 10];
@@ -19,7 +19,7 @@ $arr = ["x" => -2147483648, "y" => 0, "width" => -10, "height" => 10];
try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$arr = ["x" => 1, "y" => 2147483647, "width" => 10, "height" => 10];
@@ -27,7 +27,7 @@ $arr = ["x" => 1, "y" => 2147483647, "width" => 10, "height" => 10];
try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$arr = ["x" => 1, "y" => -2147483648, "width" => 10, "height" => -10];
@@ -35,11 +35,11 @@ $arr = ["x" => 1, "y" => -2147483648, "width" => 10, "height" => -10];
try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-imagecrop(): Argument #2 ($rectangle) overflow with "x" and "width" keys
-imagecrop(): Argument #2 ($rectangle) underflow with "x" and "width" keys
-imagecrop(): Argument #2 ($rectangle) overflow with "y" and "height" keys
-imagecrop(): Argument #2 ($rectangle) underflow with "y" and "height" keys
+ValueError: imagecrop(): Argument #2 ($rectangle) overflow with "x" and "width" keys
+ValueError: imagecrop(): Argument #2 ($rectangle) underflow with "x" and "width" keys
+ValueError: imagecrop(): Argument #2 ($rectangle) overflow with "y" and "height" keys
+ValueError: imagecrop(): Argument #2 ($rectangle) underflow with "y" and "height" keys
diff --git a/ext/gd/tests/imagefilter2.phpt b/ext/gd/tests/imagefilter2.phpt
index 99b73ffc133d..5f0ec6615ae6 100644
--- a/ext/gd/tests/imagefilter2.phpt
+++ b/ext/gd/tests/imagefilter2.phpt
@@ -20,17 +20,17 @@ foreach ([-1, PHP_INT_MAX] as $val) {
try {
imagefilter($im, IMG_FILTER_SCATTER, $val, 0);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagefilter($im, IMG_FILTER_SCATTER, 0, $val);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
}
?>
--EXPECTF--
-imagefilter(): Argument #3 must be between 0 and %d
-imagefilter(): Argument #4 must be between 0 and %d
-imagefilter(): Argument #3 must be between 0 and %d
-imagefilter(): Argument #4 must be between 0 and %d
+ValueError: imagefilter(): Argument #3 must be between 0 and %d
+ValueError: imagefilter(): Argument #4 must be between 0 and %d
+ValueError: imagefilter(): Argument #3 must be between 0 and %d
+ValueError: imagefilter(): Argument #4 must be between 0 and %d
diff --git a/ext/gd/tests/imagefilter_error1.phpt b/ext/gd/tests/imagefilter_error1.phpt
index cc9904e320da..f2e6e1c3e696 100644
--- a/ext/gd/tests/imagefilter_error1.phpt
+++ b/ext/gd/tests/imagefilter_error1.phpt
@@ -12,14 +12,14 @@ $image = imagecreatetruecolor(180, 30);
try {
var_dump(imagefilter($image));
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(imagefilter(20, 1));
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagefilter() expects at least 2 arguments, 1 given
-imagefilter(): Argument #1 ($image) must be of type GdImage, int given
+ArgumentCountError: imagefilter() expects at least 2 arguments, 1 given
+TypeError: imagefilter(): Argument #1 ($image) must be of type GdImage, int given
diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
index 5765543be1df..95995b78b1f2 100644
--- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
@@ -8,8 +8,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagegd($image, "./foo\0bar");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagegd(): Argument #2 ($file) must not contain any null bytes
+ValueError: imagegd(): Argument #2 ($file) must not contain any null bytes
diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt
index 657e11dd1788..fe4490acdde8 100644
--- a/ext/gd/tests/imagegd_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt
@@ -8,8 +8,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagegd($image, "./foo\0bar");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagegd(): Argument #2 ($file) must not contain any null bytes
+ValueError: imagegd(): Argument #2 ($file) must not contain any null bytes
diff --git a/ext/gd/tests/imagegif_nullbyte_injection.phpt b/ext/gd/tests/imagegif_nullbyte_injection.phpt
index 5cdb6f6879f8..a0b98badb2d4 100644
--- a/ext/gd/tests/imagegif_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegif_nullbyte_injection.phpt
@@ -8,8 +8,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagegif($image, "./foo\0bar");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagegif(): Argument #2 ($file) must not contain null bytes
+TypeError: imagegif(): Argument #2 ($file) must not contain null bytes
diff --git a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
index 6863626a0c93..1b260de67521 100644
--- a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
@@ -15,8 +15,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagejpeg($image, "./foo\0bar");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagejpeg(): Argument #2 ($file) must not contain null bytes
+TypeError: imagejpeg(): Argument #2 ($file) must not contain null bytes
diff --git a/ext/gd/tests/imagepng_nullbyte_injection.phpt b/ext/gd/tests/imagepng_nullbyte_injection.phpt
index f5ec342b9c6e..ca04a5be9e1a 100644
--- a/ext/gd/tests/imagepng_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagepng_nullbyte_injection.phpt
@@ -15,8 +15,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagepng($image, "./foo\0bar");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagepng(): Argument #2 ($file) must not contain null bytes
+TypeError: imagepng(): Argument #2 ($file) must not contain null bytes
diff --git a/ext/gd/tests/imageresolution_basic.phpt b/ext/gd/tests/imageresolution_basic.phpt
index 74dc8c59dcda..d50173eb74d0 100644
--- a/ext/gd/tests/imageresolution_basic.phpt
+++ b/ext/gd/tests/imageresolution_basic.phpt
@@ -18,17 +18,17 @@ $res = imageresolution($exp);
try {
imageresolution($exp, PHP_INT_MAX);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imageresolution($exp, 127, -PHP_INT_MAX);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
imageresolution($exp, 0, 0);
var_dump(imageresolution($exp) == $res);
?>
--EXPECTF--
-imageresolution(): Argument #2 ($resolution_x) must be between 0 and %d
-imageresolution(): Argument #3 ($resolution_y) must be between 0 and %d
+ValueError: imageresolution(): Argument #2 ($resolution_x) must be between 0 and %d
+ValueError: imageresolution(): Argument #3 ($resolution_y) must be between 0 and %d
bool(true)
diff --git a/ext/gd/tests/imageresolution_jpeg.phpt b/ext/gd/tests/imageresolution_jpeg.phpt
index 739b6949a871..a918c7402d2c 100644
--- a/ext/gd/tests/imageresolution_jpeg.phpt
+++ b/ext/gd/tests/imageresolution_jpeg.phpt
@@ -27,7 +27,7 @@ imageresolution($exp, 71, 299);
try {
imagejpeg($exp, $filename, 101);
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
@@ -43,7 +43,7 @@ array(2) {
[1]=>
int(299)
}
-imagejpeg(): Argument #3 ($quality) must be at between -1 and 100
+ValueError: imagejpeg(): Argument #3 ($quality) must be at between -1 and 100
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg');
diff --git a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
index 1c25fdab2564..625e77a7bbe0 100644
--- a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
@@ -15,8 +15,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagewbmp($image, "./foo\0bar");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagewbmp(): Argument #2 ($file) must not contain null bytes
+TypeError: imagewbmp(): Argument #2 ($file) must not contain null bytes
diff --git a/ext/gd/tests/imagewebp_nullbyte_injection.phpt b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
index 3fcb687eeeab..27169d6f4639 100644
--- a/ext/gd/tests/imagewebp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
@@ -15,8 +15,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagewebp($image, "./foo\0bar");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagewebp(): Argument #2 ($file) must not contain null bytes
+TypeError: imagewebp(): Argument #2 ($file) must not contain null bytes
diff --git a/ext/gd/tests/imagexbm_nullbyte_injection.phpt b/ext/gd/tests/imagexbm_nullbyte_injection.phpt
index 701f910014c2..59892a25af59 100644
--- a/ext/gd/tests/imagexbm_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagexbm_nullbyte_injection.phpt
@@ -8,8 +8,8 @@ $image = imagecreate(1,1);// 1px image
try {
imagexbm($image, "./foo\0bar");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-imagexbm(): Argument #2 ($filename) must not contain any null bytes
+ValueError: imagexbm(): Argument #2 ($filename) must not contain any null bytes
diff --git a/ext/gd/tests/pngcomp.phpt b/ext/gd/tests/pngcomp.phpt
index 81beacad8a54..c6b65dd08139 100644
--- a/ext/gd/tests/pngcomp.phpt
+++ b/ext/gd/tests/pngcomp.phpt
@@ -18,12 +18,12 @@ gd
try {
imagepng($im, $cwd . '/test_pngcomp.png', -2);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
imagepng($im, $cwd . '/test_pngcomp.png', 10);
} catch (\ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
echo "PNG compression test: ";
imagepng($im, $cwd . '/test_pngcomp.png', 9);
@@ -37,6 +37,6 @@ gd
@unlink($cwd . "/test_pngcomp.png");
?>
--EXPECT--
-imagepng(): Argument #3 ($quality) must be between -1 and 9
-imagepng(): Argument #3 ($quality) must be between -1 and 9
+ValueError: imagepng(): Argument #3 ($quality) must be between -1 and 9
+ValueError: imagepng(): Argument #3 ($quality) must be between -1 and 9
PNG compression test: ok
diff --git a/ext/gd/tests/webp_basic.phpt b/ext/gd/tests/webp_basic.phpt
index ef2fae865256..9f6272c52938 100644
--- a/ext/gd/tests/webp_basic.phpt
+++ b/ext/gd/tests/webp_basic.phpt
@@ -40,7 +40,7 @@ var_dump(mse($im1, $im_lossless) == 0);
try {
imagewebp($im1, $filename, -10);
} catch (\ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
@@ -51,4 +51,4 @@ try {
--EXPECT--
Is lossy conversion close enough? bool(true)
Does lossless conversion work? bool(true)
-imagewebp(): Argument #3 ($quality) must be greater than or equal to -1
+ValueError: imagewebp(): Argument #3 ($quality) must be greater than or equal to -1