1--TEST--
2Testing wrong array size 3x2 in imageconvolution() of GD library
3--CREDITS--
4Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
5#testfest PHPSP on 2009-06-20
6--SKIPIF--
7<?php
8if (!extension_loaded("gd")) die("skip GD not present");
9?>
10--FILE--
11<?php
12require __DIR__ . '/func.inc';
13
14$image = imagecreatetruecolor(180, 30);
15
16// Writes the text and apply a gaussian blur on the image
17imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
18
19$gaussian = array(
20    array(1.0, 2.0, 1.0),
21    array(2.0, 4.0, 2.0),
22    array(1.0, 2.0)
23);
24
25$gaussian_bad_key = array(
26    array(1.0, 2.0, 1.0),
27    array(2.0, 4.0, 2.0),
28    array(1.0, 2.0, 'x' => 1.0)
29);
30
31trycatch_dump(
32    fn() => imageconvolution($image, $gaussian, 16, 0),
33    fn() => imageconvolution($image, $gaussian_bad_key, 16, 0)
34);
35
36?>
37--EXPECT--
38!! [ValueError] imageconvolution(): Argument #2 ($matrix) must be a 3x3 array, matrix[2] only has 2 elements
39!! [ValueError] imageconvolution(): Argument #2 ($matrix) must be a 3x3 array, matrix[2][2] cannot be found (missing integer key)
40