From 2e42f8ed7cb05a78d2badaaa45ee7f27574f168e Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 19 Mar 2021 16:39:26 +0100 Subject: [PATCH 1/3] Deprecate $num_points parameter of image(open|filled)polygon Cf. . --- ext/gd/gd.c | 2 ++ ext/gd/tests/bug55005.phpt | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 609a61ebc243c..84bb2abd5dd6e 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2673,6 +2673,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 4514b80fed3b5..35d3376561df5 100644 --- a/ext/gd/tests/bug55005.phpt +++ b/ext/gd/tests/bug55005.phpt @@ -16,6 +16,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 From bcdb76b2d8a50766fae37be4f53e2bff229a322f Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 19 Mar 2021 17:04:39 +0100 Subject: [PATCH 2/3] Start message with upper case letter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Máté Kocsis --- ext/gd/gd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 84bb2abd5dd6e..5e331f2aa971e 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2674,7 +2674,7 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) } NPOINTS /= 2; } else { - php_error_docref(NULL, E_DEPRECATED, "using the $num_points parameter is deprecated"); + php_error_docref(NULL, E_DEPRECATED, "Using the $num_points parameter is deprecated"); } im = php_gd_libgdimageptr_from_zval_p(IM); From c00371b75ebd1af4c8c0a79dc28762b5e799e09e Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 21 Mar 2021 17:47:12 +0100 Subject: [PATCH 3/3] Fix error message in test Co-authored-by: George Peter Banyard <7906688+Girgias@users.noreply.github.com> --- ext/gd/tests/bug55005.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/gd/tests/bug55005.phpt b/ext/gd/tests/bug55005.phpt index 35d3376561df5..0bcdb73c995ac 100644 --- a/ext/gd/tests/bug55005.phpt +++ b/ext/gd/tests/bug55005.phpt @@ -17,8 +17,8 @@ trycatch_dump( ); ?> --EXPECTF-- -Deprecated: imagefilledpolygon(): using the $num_points parameter is deprecated in %s on line %d +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 +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