1--TEST-- 2imagefilter() function test 3--EXTENSIONS-- 4gd 5--SKIPIF-- 6<?php 7 if (PHP_INT_SIZE != 8) die("skip only for 64 bits platforms"); 8 if (!function_exists("imagefilter")) die("skip requires imagefilter function"); 9 if (!(imagetypes() & IMG_PNG)) { 10 die("skip No PNG support"); 11 } 12?> 13--FILE-- 14<?php 15$SAVE_DIR = __DIR__; 16$SOURCE_IMG = $SAVE_DIR . "/test.png"; 17$im = imagecreatefrompng($SOURCE_IMG); 18 19foreach ([-1, PHP_INT_MAX] as $val) { 20 try { 21 imagefilter($im, IMG_FILTER_SCATTER, $val, 0); 22 } catch (\ValueError $e) { 23 echo $e->getMessage() . PHP_EOL; 24 } 25 try { 26 imagefilter($im, IMG_FILTER_SCATTER, 0, $val); 27 } catch (\ValueError $e) { 28 echo $e->getMessage() . PHP_EOL; 29 } 30} 31?> 32--EXPECTF-- 33imagefilter(): Argument #3 must be between 0 and %d 34imagefilter(): Argument #4 must be between 0 and %d 35imagefilter(): Argument #3 must be between 0 and %d 36imagefilter(): Argument #4 must be between 0 and %d 37