xref: /PHP-8.0/ext/gd/tests/bug55005.phpt (revision 14a26db3)
1--TEST--
2Bug #55005 (imagepolygon num_points requirement)
3--SKIPIF--
4<?php
5if (!extension_loaded('gd')) die('skip gd extension not available');
6?>
7--FILE--
8<?php
9require_once __DIR__ . '/func.inc';
10
11$g = imagecreate(300, 300);
12$bgnd = imagecolorallocate($g, 255, 255, 255);
13$fgnd = imagecolorallocate($g, 0, 0, 0);
14trycatch_dump(
15    fn () => imagefilledpolygon($g, array(100,10, 100,100, 180,100), 2, $fgnd),
16    fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd)
17);
18?>
19--EXPECT--
20!! [ValueError] imagefilledpolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3
21!! [ValueError] imagepolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3
22