From: Mark Date: Tue, 3 Sep 2019 23:49:30 +0000 (+0200) Subject: Negative checks for gamma X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87dbb32246778548b381d197bfda18e81b3829cb;p=php Negative checks for gamma --- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 0837f83084..7dd14ab5d0 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2445,8 +2445,8 @@ PHP_FUNCTION(imagegammacorrect) } if ( input <= 0.0 || output <= 0.0 ) { - php_error_docref(NULL, E_WARNING, "Gamma values should be positive"); - RETURN_FALSE; + zend_throw_error(NULL, "Gamma values must be positive"); + return; } gamma = input / output; diff --git a/ext/gd/tests/bug72730.phpt b/ext/gd/tests/bug72730.phpt index 403354d1e2..e3a7971565 100644 --- a/ext/gd/tests/bug72730.phpt +++ b/ext/gd/tests/bug72730.phpt @@ -6,10 +6,15 @@ if (!function_exists("imagecreatetruecolor")) die("skip"); ?> --FILE-- imagegammacorrect($img, -1, 1337) +); + ?> -DONE ---EXPECTF-- -Warning: imagegammacorrect(): Gamma values should be positive in %sbug72730.php on line %d -DONE +--EXPECT-- +!! [Error] Gamma values must be positive