Skip to content

Commit b6df294

Browse files
authored
Fix the argument named by the imageaffine() element TypeError (#25369)
1 parent 7302ff4 commit b6df294

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎ext/gd/gd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4142,7 +4142,7 @@ PHP_FUNCTION(imageaffine)
41424142
}
41434143
break;
41444144
default:
4145-
zend_argument_type_error(3, "contains invalid type for element %i", i);
4145+
zend_argument_type_error(2, "contains invalid type for element %i", i);
41464146
RETURN_THROWS();
41474147
}
41484148
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
imageaffine(): the TypeError for an invalid element names the $affine argument
3+
--EXTENSIONS--
4+
gd
5+
--FILE--
6+
<?php
7+
$im = imagecreatetruecolor(20, 20);
8+
try {
9+
imageaffine($im, [1, 0, null, 1, 0, 0]);
10+
} catch (Throwable $e) {
11+
echo $e::class, ': ', $e->getMessage(), "\n";
12+
}
13+
?>
14+
--EXPECT--
15+
TypeError: imageaffine(): Argument #2 ($affine) contains invalid type for element 2

0 commit comments

Comments
 (0)