xref: /php-src/ext/gd/tests/gh16255.phpt (revision 6c198e38)
1--TEST--
2GH-16255 (Unexpected nan value in ext/gd/libgd/gd_filter.c)
3--EXTENSIONS--
4gd
5--CREDITS--
6cmb69
7--FILE--
8<?php
9$matrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
10$im = imagecreatetruecolor(40, 40);
11
12try {
13    imageconvolution($im, $matrix, NAN, 1.0);
14} catch (ValueError $e) {
15    echo $e->getMessage(), "\n";
16}
17
18try {
19    imageconvolution($im, $matrix,  2.225E-307, 1.0);
20} catch (ValueError $e) {
21    echo $e->getMessage(), "\n";
22}
23
24try {
25    imageconvolution($im, $matrix, 1, NAN);
26} catch (ValueError $e) {
27    echo $e->getMessage(), "\n";
28}
29
30?>
31--EXPECT--
32imageconvolution(): Argument #3 ($divisor) must be finite
33imageconvolution(): Argument #3 ($divisor) must not be 0
34imageconvolution(): Argument #4 ($offset) must be finite
35