that allow global flag to configure query() or evaluate() calls.
- GD:
+ . Fixed bug #55005 (imagepolygon num_points requirement). (cmb)
. Replaced gd resources with objects. (Mark Randall)
. Removed deprecated image2wbmp(). (cmb)
. Removed deprecated png2wbmp() and jpeg2wbmp(). (cmb)
col = COL;
nelem = zend_hash_num_elements(Z_ARRVAL_P(POINTS));
- if (nelem < 6) {
- zend_value_error("You must have at least 3 points in your array");
- return;
- }
-
- if (npoints <= 0) {
- zend_value_error("You must give a positive number of points");
+ if (npoints < 3) {
+ zend_value_error("Polygon must have at least 3 points");
return;
}
--- /dev/null
+--TEST--\r
+Bug #55005 (imagepolygon num_points requirement)\r
+--SKIPIF--\r
+<?php\r
+if (!extension_loaded('gd')) die('skip gd extension not available');\r
+?>\r
+--FILE--\r
+<?php\r
+require_once __DIR__ . '/func.inc';\r
+\r
+$g = imagecreate(300, 300);\r
+$bgnd = imagecolorallocate($g, 255, 255, 255);\r
+$fgnd = imagecolorallocate($g, 0, 0, 0);\r
+trycatch_dump(\r
+ fn () => imagefilledpolygon($g, array(100,10, 100,100, 180,100), 2, $fgnd),\r
+ fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd)\r
+);\r
+?>\r
+--EXPECT--\r
+!! [ValueError] Polygon must have at least 3 points\r
+!! [ValueError] Polygon must have at least 3 points\r
+++ /dev/null
---TEST--
-imagefilledpolygon() with a negative num of points
---SKIPIF--
-<?php
- if (!function_exists('imagefilledpolygon')) die('skip imagefilledpolygon() not available');
-?>
---FILE--
-<?php
-require __DIR__ . '/func.inc';
-
-$im = imagecreate(100, 100);
-$black = imagecolorallocate($im, 0, 0, 0);
-
-trycatch_dump(
- fn() => imagefilledpolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)
-);
-
-imagedestroy($im);
-?>
---EXPECT--
-!! [ValueError] You must give a positive number of points
+++ /dev/null
---TEST--
-imagepolygon() with a negative num of points
---SKIPIF--
-<?php
- if (!function_exists('imagepolygon')) die('skip imagepolygon() not available');
-?>
---FILE--
-<?php
-require __DIR__ . '/func.inc';
-
-$im = imagecreate(100, 100);
-$black = imagecolorallocate($im, 0, 0, 0);
-
-trycatch_dump(
- fn() => imagepolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)
-);
-
-imagedestroy($im);
-?>
---EXPECT--
-!! [ValueError] You must give a positive number of points