]> granicus.if.org Git - php/commitdiff
Warnings to Errors: imagesetstyle
authorMark <mrandall@digitellinc.com>
Tue, 3 Sep 2019 23:10:56 +0000 (01:10 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 4 Sep 2019 13:21:59 +0000 (15:21 +0200)
ext/gd/gd.c
ext/gd/tests/bug72709.phpt

index 027933ee64feb359a9400768be0082b98c051150..b0215386d982a24fe03129ccbd2bec3ab2b1bbd8 100644 (file)
@@ -798,8 +798,8 @@ PHP_FUNCTION(imagesetstyle)
 
     num_styles = zend_hash_num_elements(Z_ARRVAL_P(styles));
     if (num_styles == 0) {
-        php_error_docref(NULL, E_WARNING, "styles array must not be empty");
-        RETURN_FALSE;
+        zend_throw_error(NULL, "Styles array must not be empty");
+        return;
     }
 
        /* copy the style values in the stylearr */
index 1c5b1f4ae0420808504e62563edc28635293d360..2963f1c1041de5f8c57ae6dd8b170445d6f2b82f 100644 (file)
@@ -7,12 +7,18 @@ if (!extension_loaded('gd')) die('skip ext/gd not available');
 --FILE--
 <?php
 $im = imagecreatetruecolor(1, 1);
-var_dump(imagesetstyle($im, array()));
+
+try { 
+    var_dump(imagesetstyle($im, array()));
+}
+catch (\Error $ex) {
+    echo $ex->getMessage() . "\n";
+}
+
 imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
 imagedestroy($im);
 ?>
 ====DONE====
---EXPECTF--
-Warning: imagesetstyle(): styles array must not be empty in %s%ebug72709.php on line %d
-bool(false)
+--EXPECT--
+Styles array must not be empty
 ====DONE====