diff --git a/UPGRADING b/UPGRADING index 10734853303..8a4943748f4 100644 --- a/UPGRADING +++ b/UPGRADING @@ -370,6 +370,9 @@ PHP 8.1 UPGRADE NOTES . The filter.default ini setting is deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_1 +- GD: + . The $num_points parameter of image(open|filled)polygon has been deprecated. + - Hash: . The mhash(), mhash_keygen_s2k(), mhash_count(), mhash_get_block_size() and mhash_get_hash_name() functions are deprecated. Use the hash_*() APIs diff --git a/ext/gd/gd.c b/ext/gd/gd.c index f7723e166fb..6634ec8b851 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2726,6 +2726,8 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) RETURN_THROWS(); } NPOINTS /= 2; + } else { + php_error_docref(NULL, E_DEPRECATED, "Using the $num_points parameter is deprecated"); } im = php_gd_libgdimageptr_from_zval_p(IM); diff --git a/ext/gd/tests/bug55005.phpt b/ext/gd/tests/bug55005.phpt index d29dfc61084..0771fa6d617 100644 --- a/ext/gd/tests/bug55005.phpt +++ b/ext/gd/tests/bug55005.phpt @@ -14,6 +14,9 @@ trycatch_dump( fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd) ); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: imagefilledpolygon(): Using the $num_points parameter is deprecated in %s on line %d !! [ValueError] imagefilledpolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3 + +Deprecated: imagepolygon(): Using the $num_points parameter is deprecated in %s on line %d !! [ValueError] imagepolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3