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--EXTENSIONS--
7gd
8--FILE--
9<?php
10require __DIR__ . '/func.inc';
11
12$image = imagecreatetruecolor(180, 30);
13
14// Writes the text and apply a gaussian blur on the image
15imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00);
16
17$gaussian = array(
18    array(1.0, 2.0, 1.0),
19    array(2.0, 4.0, 2.0),
20    array(1.0, 2.0)
21);
22
23$gaussian_bad_key = array(
24    array(1.0, 2.0, 1.0),
25    array(2.0, 4.0, 2.0),
26    array(1.0, 2.0, 'x' => 1.0)
27);
28
29trycatch_dump(
30    fn() => imageconvolution($image, $gaussian, 16, 0),
31    fn() => imageconvolution($image, $gaussian_bad_key, 16, 0)
32);
33
34?>
35--EXPECT--
36!! [ValueError] imageconvolution(): Argument #2 ($matrix) must be a 3x3 array, matrix[2] only has 2 elements
37!! [ValueError] imageconvolution(): Argument #2 ($matrix) must be a 3x3 array, matrix[2][2] cannot be found (missing integer key)
38