mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix parameter numbers for imagecolorset()
This is the 8.2 & 8.3 version of GH-14477.
This commit is contained in:
committed by
Niels Dossche
parent
473cbdf558
commit
da769be7c9
3
NEWS
3
NEWS
@@ -18,6 +18,9 @@ PHP NEWS
|
||||
- DOM:
|
||||
. Fixed bug GH-14343 (Memory leak in xml and dom). (nielsdos)
|
||||
|
||||
- GD:
|
||||
. Fix parameter numbers for imagecolorset(). (Giovanni Giacobbi)
|
||||
|
||||
- Intl:
|
||||
. Fix reference handling in SpoofChecker. (nielsdos)
|
||||
|
||||
|
||||
@@ -2216,9 +2216,9 @@ PHP_FUNCTION(imagecolorset)
|
||||
|
||||
im = php_gd_libgdimageptr_from_zval_p(IM);
|
||||
|
||||
CHECK_RGBA_RANGE(red, Red, 2);
|
||||
CHECK_RGBA_RANGE(green, Green, 3);
|
||||
CHECK_RGBA_RANGE(blue, Blue, 4);
|
||||
CHECK_RGBA_RANGE(red, Red, 3);
|
||||
CHECK_RGBA_RANGE(green, Green, 4);
|
||||
CHECK_RGBA_RANGE(blue, Blue, 5);
|
||||
|
||||
col = color;
|
||||
|
||||
|
||||
26
ext/gd/tests/imagecolorset_error1.phpt
Normal file
26
ext/gd/tests/imagecolorset_error1.phpt
Normal file
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
imagecolorset() parameters errors
|
||||
--EXTENSIONS--
|
||||
gd
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/func.inc';
|
||||
|
||||
$im = imagecreate(5, 5);
|
||||
|
||||
$c = imagecolorallocatealpha($im, 3, 4, 5, 6);
|
||||
|
||||
trycatch_dump(
|
||||
fn() => imagecolorset($im, $c, -3, 4, 5, 6),
|
||||
fn() => imagecolorset($im, $c, 3, -4, 5, 6),
|
||||
fn() => imagecolorset($im, $c, 3, 4, -5, 6),
|
||||
fn() => imagecolorset($im, $c, 3, 4, 5, -6),
|
||||
);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
!! [ValueError] imagecolorset(): Argument #3 ($red) must be between 0 and 255 (inclusive)
|
||||
!! [ValueError] imagecolorset(): Argument #4 ($green) must be between 0 and 255 (inclusive)
|
||||
!! [ValueError] imagecolorset(): Argument #5 ($blue) must be between 0 and 255 (inclusive)
|
||||
NULL
|
||||
Reference in New Issue
Block a user