1--TEST--
2Testing imagetruecolortopalette(): out of range parameter 3
3--CREDITS--
4Rafael Dohms <rdohms [at] gmail [dot] com>
5--EXTENSIONS--
6gd
7--SKIPIF--
8<?php
9    if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
10?>
11--FILE--
12<?php
13require __DIR__  . '/func.inc';
14
15$image = imagecreatetruecolor(50, 50);
16
17trycatch_dump(
18    fn() => imagetruecolortopalette($image, true, 0),
19    fn() => imagetruecolortopalette($image, true, -1)
20);
21
22?>
23--EXPECT--
24!! [ValueError] imagetruecolortopalette(): Argument #3 ($num_colors) must be greater than 0 and less than 2147483647
25!! [ValueError] imagetruecolortopalette(): Argument #3 ($num_colors) must be greater than 0 and less than 2147483647
26