]> granicus.if.org Git - php/commit
Make the $num_points parameter of php_imagepolygon optional
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 14 Nov 2019 08:46:43 +0000 (09:46 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 15 Nov 2019 08:41:10 +0000 (09:41 +0100)
commit2de79f085502315d1f53822eee54e9f39dd809f6
tree2ccd17381a3acada9c067ae98825c73ea740369a
parentd65e59de9b61761c9839ea6379285b10936e03e1
Make the $num_points parameter of php_imagepolygon optional

That parameter is mostly useless in practise, and likely has been
directly ported from the underlying `gdImagePolygon()` and friends,
which require that parameter since the number of elements of the point
array would otherwise be unknown.  Typical usages of `imagepolygon()`,
`imageopenpolygon()` and `imagefilledpolygon()` pass `count($points)/2`
or hard-code this value as literal.  Since explicitly specifying this
parameter is annoying and error-prone, we offer the possibility to omit
it, in which case the `$points` array must have an even number of
elements, and the number of points is calculated as `count($points)/2`.
14 files changed:
NEWS
UPGRADING
ext/gd/gd.c
ext/gd/gd.stub.php
ext/gd/gd_arginfo.h
ext/gd/tests/bug43073.phpt
ext/gd/tests/bug53504.phpt
ext/gd/tests/bug55005.phpt
ext/gd/tests/bug64641.phpt
ext/gd/tests/imagefilledpolygon_basic.phpt
ext/gd/tests/imageopenpolygon_basic.phpt
ext/gd/tests/imagepolygon_aa.phpt
ext/gd/tests/imagepolygon_basic.phpt
ext/gd/tests/libgd00100.phpt