Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97915 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19379 invoked from network); 21 Jan 2017 17:41:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2017 17:41:46 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.20 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.20 mout.gmx.net Received: from [212.227.17.20] ([212.227.17.20:65274] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/9F-00729-85D93885 for ; Sat, 21 Jan 2017 12:41:45 -0500 Received: from [192.168.2.109] ([217.82.227.219]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MGEv5-1ciTw21fEt-00FBRg for ; Sat, 21 Jan 2017 18:41:41 +0100 To: "internals@lists.php.net" Message-ID: <840ab355-966f-7c49-a337-5335a5022de5@gmx.de> Date: Sat, 21 Jan 2017 18:42:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:1w0tlNxoqQfl/g/vnRICaz/Zdl+B5fOJH8mI1EA4sIO/gDyliK+ kDIgXTVboU8spEtIVcA5V5fMlzucnyZtr8gGegR2QoNvwdiPCfLccXmxs0zht5YP2ignKXK 4NkJgtNpbqRPeciCAlrIeCALffxS4JUy0exX/R0Q86FZFos7tmc5hCFbEumiuwBZzZnXyTO Z2/FcE+zAY26HzpjbMFQg== X-UI-Out-Filterresults: notjunk:1;V01:K0:NNk652Q/1YQ=:dkCLtXsfDkUXpr6Aeh6s2b IhsVv2pcdR2G8HvV8rjdgDd+wX9qLx/wtBe07B5+GgNF76R3sZgKJS924s3DZQq1aLEhJbyZh T5XdLrbJ+LVaoVQuNZcoaL32yvoYQtfDqNjZ2/icjiz1tnqGj2/KsdEu0HNxYAlTVlXFUjlc8 yJfyPg+angXuefcVwG4qg31w5a4hvYUQP/JuKTtWmsvGFO8l6CnN43IRknqmXEGJAFwH851Yk LecoJy6ieNR5BfePMjsFex4f6YGgIenRDF4zv3y+UqJi8e7fr1PvesWJxNSOzmDCkcACShcbi uU4bPFKibgOYboBKl2jCFHyVVIT8WlsofFUrZUzr02Wdyb+VspRBLRhXwRaKk0OSaYIr6OI7+ p9gWBc1RoSdHR+yNMS4rKNJ5WpvFDXsFKqwnbMZ3HsGHOD95sLHFaEvdKGpaRG6PV1aInITzD GugHKBGj3TNvBFN6avLbj+3mPlIy8WXcxactxBzUkJuXNtFxrOaaQUT+pogd7QeifThnAyuDB ZqeR5+hTOnezEjmY8/5nNWhAn5jWwvNCmCoks3dtvBJvmAvQO/HU2ek3GvzSDJD4Dxvt+M1S3 4kT+pwZ4Dq+PbCB9jv7411rVhzWhpuJqXiR4fqkHvBSNg2eYaKwziC4AASZyxQz9qD/ySUDby wJ2jK9moPvpatxFtVxaLIFnMOkWo4PD43TwVoTi3ny90/MBJ0ripTLPavxoosPsH+mPZaEwQk GSRJp6VZe0NuwhXYUbPAqeaDT21RO0LdXHmk1kTiEjlu7hOX+B+8tj6dJ8AEeDI4I5FbO+3Jy aSRFwnb Subject: =?UTF-8?Q?imagepolygon=28=29_=e2=80=93_number_of_points?= From: cmbecker69@gmx.de ("Christoph M. Becker") Hi! This issue has been filed to our bugtracker years ago[1], but didn't deserve much attention, so I'm forwarding to the list. imagepolygon(), imagefilledpolygon() and imageopenpolygon() have the following signature: image*polygon(resource $im, array $points, int $num_points, int $col) Note the third parameter, $num_points, which doesn't make much sense for PHP, and has most likely being directly ported from the underlying libgd implementation of gdImage*Polygon[2]. Even worse, while the common implementation[3] checks that $points (which would better have been called $coordinate, by the way) has at least 6 elements, $num_points can be smaller than 3, what will cause gdImage*Polygon() to be called with only so many points. That is not an issue per se, as gdImage*Polygon() is capable of handling monogons and digons, but of course it doesn't make sense to force the programmer to construct a larger array with unused values to do so. Furthermore the imagefilledpolygon() man page[4] states that $num_points must be greater than or equal to 3, but neither of the other man pages document this. In the long run (i.e. for PHP 8) I'd suggest to purge the $num_points parameter altogether, relying solely on the number of $points given. For PHP 7.2 I propose to weaken the constraint on count($points) so that 2 would be sufficient instead of the 6 required now. Would the proposed change for PHP 7.2 require an RFC, or would a PR suffice? [1] [2] [3] [4] -- Christoph M. Becker