bug55005.phpt 829 B

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