Skip to content

Commit e1285c4

Browse files
committed
Deprecate $num_points parameter of image(open|filled)polygon
Cf. <https://wiki.php.net/rfc/deprecations_php_8_1#num_points_parameter_of_image_open_filled_polygon>. Co-authored-by: Máté Kocsis <[email protected]> Co-authored-by: George Peter Banyard <[email protected]> Closes GH-6789.
1 parent 4b3615a commit e1285c4

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ PHP 8.1 UPGRADE NOTES
370370
. The filter.default ini setting is deprecated.
371371
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
372372

373+
- GD:
374+
. The $num_points parameter of image(open|filled)polygon has been deprecated.
375+
373376
- Hash:
374377
. The mhash(), mhash_keygen_s2k(), mhash_count(), mhash_get_block_size() and
375378
mhash_get_hash_name() functions are deprecated. Use the hash_*() APIs

ext/gd/gd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,6 +2726,8 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
27262726
RETURN_THROWS();
27272727
}
27282728
NPOINTS /= 2;
2729+
} else {
2730+
php_error_docref(NULL, E_DEPRECATED, "Using the $num_points parameter is deprecated");
27292731
}
27302732

27312733
im = php_gd_libgdimageptr_from_zval_p(IM);

ext/gd/tests/bug55005.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ trycatch_dump(
1414
fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd)
1515
);
1616
?>
17-
--EXPECT--
17+
--EXPECTF--
18+
Deprecated: imagefilledpolygon(): Using the $num_points parameter is deprecated in %s on line %d
1819
!! [ValueError] imagefilledpolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3
20+
21+
Deprecated: imagepolygon(): Using the $num_points parameter is deprecated in %s on line %d
1922
!! [ValueError] imagepolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3

0 commit comments

Comments
 (0)