xref: /php-src/ext/gd/tests/bug55005.phpt (revision e1285c4a)
1--TEST--
2Bug #55005 (imagepolygon num_points requirement)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7require_once __DIR__ . '/func.inc';
8
9$g = imagecreate(300, 300);
10$bgnd = imagecolorallocate($g, 255, 255, 255);
11$fgnd = imagecolorallocate($g, 0, 0, 0);
12trycatch_dump(
13    fn () => imagefilledpolygon($g, array(100,10, 100,100, 180,100), 2, $fgnd),
14    fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd)
15);
16?>
17--EXPECTF--
18Deprecated: imagefilledpolygon(): Using the $num_points parameter is deprecated in %s on line %d
19!! [ValueError] imagefilledpolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3
20
21Deprecated: imagepolygon(): Using the $num_points parameter is deprecated in %s on line %d
22!! [ValueError] imagepolygon(): Argument #3 ($num_points_or_color) must be greater than or equal to 3
23