]> granicus.if.org Git - php/commitdiff
Negative checks for gamma
authorMark <mrandall@digitellinc.com>
Tue, 3 Sep 2019 23:49:30 +0000 (01:49 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 4 Sep 2019 10:31:01 +0000 (12:31 +0200)
ext/gd/gd.c
ext/gd/tests/bug72730.phpt

index 0837f83084b45caf7f5b0c949d0abd14b5ef9951..7dd14ab5d02fc06c3416085329929cf533f178b9 100644 (file)
@@ -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;
index 403354d1e2198f09b0cc14df02486b4eedd28c40..e3a7971565ba6bb32a7ac50011099fa5d67d452a 100644 (file)
@@ -6,10 +6,15 @@ if (!function_exists("imagecreatetruecolor")) die("skip");
 ?>
 --FILE--
 <?php
+
+require __DIR__ . '/func.inc';
+
 $img =  imagecreatetruecolor(1, 1);
-imagegammacorrect($img, -1, 1337);
+
+trycatch_dump(
+    fn() => 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