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