Bug #55005 [Csd]: imagepolygon, imagefilledpolygon num_points requirement

From: Date: Sat, 16 Nov 2019 13:26:06 +0000
Subject: Bug #55005 [Csd]: imagepolygon, imagefilledpolygon num_points requirement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223743@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55005&edit=1 ID: 55005 Updated by: cmb@php.net Reported by: lbayuk at users dot sourceforge dot net Summary: imagepolygon, imagefilledpolygon num_points requirement Status: Closed Type: Bug Package: GD related Operating System: n/a PHP Version: 5.3.6 Assigned To: cmb Block user comment: N Private report: N New Comment: Supplement: yesterday a respective pull request[1] has been merged into master (which will become PHP 8.0), which appears to the best "fix" for now, namely to make the $num_points parameter optional. For later versions this parameter is likely to be deprecated, and eventually will hopefully be removed. [1] <https://github.com/php/php-src/pull/4885> Previous Comments: ------------------------------------------------------------------------ [2019-11-02 13:10:11] salathe@php.net Automatic comment on behalf of cmb Revision: http://git.php.net/?p=doc/en.git;a=commit;h=fc27b3d46ce1d965e76351e431b53c42ebcb33f5 Log: Fix #55005: imagepolygon num_points requirement ------------------------------------------------------------------------ [2019-11-02 13:06:08] cmb@php.net Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=7d96dcac2c6ce177a88ac9f15849cb499bf446bb Log: Fix #55005: imagepolygon num_points requirement ------------------------------------------------------------------------ [2019-11-02 13:05:53] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=348252 Log: Fix #55005: imagepolygon num_points requirement ------------------------------------------------------------------------ [2017-01-21 17:44:44] cmb@php.net FTR: I've just emailed the internals list: <http://news.php.net/php.internals/97915>. ------------------------------------------------------------------------ [2015-07-13 18:21:37] cmb@php.net Gee! It seems to me the cleanest solution would be to get rid of the $num_points parameter altogether, and to only check for an even number of array elements (and maybe for a minimum count). Of course, that would be a major BC break, and so is out of scope before PHP 8, at least. Should we rely on gdImage(Filled)Polygon() to behave reasonably for 1 and 2 points? The libgd implementation might change sometime to require at least 3 points, and anyway, monogons and digons are usually not recognized as polygons. So probably we shouldn't. To avoid any BC breaks for PHP 5, I suggest to only document that imagepolygon must have at least 3 vertices, but not to enforce that in the code. For PHP 7 it seems to make sense to actually check for $num_points >= 3; see the attached patch. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55005 -- Edit this bug report at https://bugs.php.net/bug.php?id=55005&edit=1

« previous php.bugs (#223743) next »