Skip to content

Commit 5af8361

Browse files
marandallcmb69
authored andcommitted
Warnings to Errors: imagesetstyle
1 parent 4a1f0eb commit 5af8361

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

ext/gd/gd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,8 @@ PHP_FUNCTION(imagesetstyle)
798798

799799
num_styles = zend_hash_num_elements(Z_ARRVAL_P(styles));
800800
if (num_styles == 0) {
801-
php_error_docref(NULL, E_WARNING, "styles array must not be empty");
802-
RETURN_FALSE;
801+
zend_throw_error(NULL, "Styles array must not be empty");
802+
return;
803803
}
804804

805805
/* copy the style values in the stylearr */

ext/gd/tests/bug72709.phpt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ if (!extension_loaded('gd')) die('skip ext/gd not available');
77
--FILE--
88
<?php
99
$im = imagecreatetruecolor(1, 1);
10-
var_dump(imagesetstyle($im, array()));
10+
11+
try {
12+
var_dump(imagesetstyle($im, array()));
13+
}
14+
catch (\Error $ex) {
15+
echo $ex->getMessage() . "\n";
16+
}
17+
1118
imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
1219
imagedestroy($im);
1320
?>
1421
====DONE====
15-
--EXPECTF--
16-
Warning: imagesetstyle(): styles array must not be empty in %s%ebug72709.php on line %d
17-
bool(false)
22+
--EXPECT--
23+
Styles array must not be empty
1824
====DONE====

0 commit comments

Comments
 (0)