-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ext/gd: checking imagescale/imagefilter invalid values.
close GH-14598
- Loading branch information
Showing
7 changed files
with
97 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--TEST-- | ||
imagefilter() function test | ||
--EXTENSIONS-- | ||
gd | ||
--SKIPIF-- | ||
<?php | ||
if (PHP_INT_SIZE != 8) die("skip only for 64 bits platforms"); | ||
if (!function_exists("imagefilter")) die("skip requires imagefilter function"); | ||
if (!(imagetypes() & IMG_PNG)) { | ||
die("skip No PNG support"); | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
$SAVE_DIR = __DIR__; | ||
$SOURCE_IMG = $SAVE_DIR . "/test.png"; | ||
$im = imagecreatefrompng($SOURCE_IMG); | ||
|
||
foreach ([-1, PHP_INT_MAX] as $val) { | ||
try { | ||
imagefilter($im, IMG_FILTER_SCATTER, $val, 0); | ||
} catch (\ValueError $e) { | ||
echo $e->getMessage() . PHP_EOL; | ||
} | ||
try { | ||
imagefilter($im, IMG_FILTER_SCATTER, 0, $val); | ||
} catch (\ValueError $e) { | ||
echo $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 |