Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ext/gd/tests/avif_decode_encode.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ 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: ';

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... ';
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/gd/tests/bug66356.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/bug72337.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/gd/tests/bug72709.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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====
4 changes: 2 additions & 2 deletions ext/gd/tests/bug73957.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ext/gd/tests/bug81739.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
bool(false)
8 changes: 4 additions & 4 deletions ext/gd/tests/colorclosest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ext/gd/tests/createfromstring.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/gdimage_prevent_cloning.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

?>
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/gh16255.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions ext/gd/tests/gh16260.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions ext/gd/tests/gh16322.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/gd/tests/gh17703.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
48 changes: 24 additions & 24 deletions ext/gd/tests/gh18005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
Loading
Loading