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