xref: /PHP-8.3/ext/gd/tests/bug67248.phpt (revision a375d547)
1--TEST--
2Bug #67248 (imageaffinematrixget missing check of parameters)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7        if(!function_exists('imageaffinematrixget')) die('skip imageaffinematrixget() not available');
8?>
9--FILE--
10<?php
11require __DIR__ . '/func.inc';
12
13for($i=0;$i<7;$i++) {
14    trycatch_dump(
15        fn() => imageaffinematrixget($i, new stdClass())
16    );
17}
18?>
19--EXPECTF--
20!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
21!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
22
23Warning: Object of class stdClass could not be converted to float in %s on line %d
24array(6) {
25  [0]=>
26  float(%f)
27  [1]=>
28  float(%f)
29  [2]=>
30  float(%f)
31  [3]=>
32  float(%f)
33  [4]=>
34  float(0)
35  [5]=>
36  float(0)
37}
38
39Warning: Object of class stdClass could not be converted to float in %s on line %d
40array(6) {
41  [0]=>
42  float(1)
43  [1]=>
44  float(0)
45  [2]=>
46  float(%f)
47  [3]=>
48  float(1)
49  [4]=>
50  float(0)
51  [5]=>
52  float(0)
53}
54
55Warning: Object of class stdClass could not be converted to float in %s on line %d
56array(6) {
57  [0]=>
58  float(1)
59  [1]=>
60  float(%f)
61  [2]=>
62  float(0)
63  [3]=>
64  float(1)
65  [4]=>
66  float(0)
67  [5]=>
68  float(0)
69}
70!! [ValueError] imageaffinematrixget(): Argument #1 ($type) must be a valid element type
71!! [ValueError] imageaffinematrixget(): Argument #1 ($type) must be a valid element type
72