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