mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix parameter numbers for imagecolorset()
This commit is contained in:
commit
7fe03e1a1b
3 changed files with 32 additions and 3 deletions
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)
|
||||
|
||||
|
|
|
@ -2212,9 +2212,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
|
Loading…
Add table
Add a link
Reference in a new issue