Skip to content

Commit 32c5b78

Browse files
committed
change from review
1 parent 72876dd commit 32c5b78

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ext/gd/gd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,12 @@ PHP_FUNCTION(imagesetstyle)
657657
zend_long tmp = zval_try_get_long(item, &failed);
658658
if (failed) {
659659
efree(stylearr);
660-
zend_argument_value_error(2, "value must be of type int, %s given", zend_zval_type_name(item));
660+
zend_argument_type_error(2, "must only have element of type int, %s given", zend_zval_type_name(item));
661661
RETURN_THROWS();
662662
}
663663
if (ZEND_LONG_EXCEEDS_INT(tmp)) {
664664
efree(stylearr);
665-
zend_argument_value_error(2, "value must be between %d and %d", INT_MIN, INT_MAX);
665+
zend_argument_type_error(2, "must have element between %d and %d", INT_MIN, INT_MAX);
666666
RETURN_THROWS();
667667
}
668668
stylearr[index++] = (int) tmp;

ext/gd/tests/gh18005.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class A {}
1212
$img = imagecreatetruecolor(1, 1);
1313
try {
1414
imagesetstyle($img, [0, new A()]);
15-
} catch (\ValueError $e) {
15+
} catch (\TypeError $e) {
1616
echo $e->getMessage() . PHP_EOL;
1717
}
1818
try {
1919
imagesetstyle($img, [0, PHP_INT_MIN]);
20-
} catch (\ValueError $e) {
20+
} catch (\TypeError $e) {
2121
echo $e->getMessage() . PHP_EOL;
2222
}
2323
try {
@@ -31,7 +31,7 @@ try {
3131
echo $e->getMessage() . PHP_EOL;
3232
}
3333
try {
34-
imagecrop($img, array("x" => PHP_INT_MIN, "y" => 0, "width" => 0, "height" => 0));
34+
imagecrop($img, ["x" => PHP_INT_MIN, "y" => 0, "width" => 0, "height" => 0]);
3535
} catch (\ValueError $e) {
3636
echo $e->getMessage() . PHP_EOL;
3737
}
@@ -73,8 +73,8 @@ try {
7373
}
7474
?>
7575
--EXPECTF--
76-
imagesetstyle(): Argument #2 ($style) value must be of type int, A given
77-
imagesetstyle(): Argument #2 ($style) value must be between %i and %d
76+
imagesetstyle(): Argument #2 ($style) must only have element of type int, A given
77+
imagesetstyle(): Argument #2 ($style) must have element between %i and %d
7878
imagefilter(): Argument #5 value must be of type int, A given
7979
imagefilter(): Argument #5 value must be between 0 and 2147483647
8080
imagecrop(): Argument #2 ($rectangle) "x" key must be between %i and %d

0 commit comments

Comments
 (0)