xref: /PHP-8.0/ext/gd/tests/gh8848.phpt (revision 9405f43b)
1--TEST--
2GH-8848 (imagecopyresized() error refers to the wrong argument)
3--SKIPIF--
4<?php
5if (!extension_loaded("gd")) die("skip gd extension not available");
6?>
7--FILE--
8<?php
9$image1 = imagecreatetruecolor(1, 1);
10$image2 = imagecreatetruecolor(1, 1);
11
12$argslist = [
13    [0, 1, 1, 1],
14    [1, 0, 1, 1],
15    [1, 1, 0, 1],
16    [1, 1, 1, 0],
17];
18
19foreach ($argslist as $args) {
20    try {
21        imagecopyresized($image1, $image2, 1, 1, 1, 1, ...$args);
22    } catch (ValueError $ex) {
23        echo $ex->getMessage(), PHP_EOL;
24    }
25}
26?>
27--EXPECT--
28imagecopyresized(): Argument #7 ($dst_width) must be greater than 0
29imagecopyresized(): Argument #8 ($dst_height) must be greater than 0
30imagecopyresized(): Argument #9 ($src_width) must be greater than 0
31imagecopyresized(): Argument #10 ($src_height) must be greater than 0
32