Commit b6df294ee07 for php
commit b6df294ee073e61411f4dd91e07f7115d435fb5d
Author: Louis-Arnaud <la.catoire@gmail.com>
Date: Tue Nov 10 16:38:22 2026 +0100
Fix the argument named by the imageaffine() element TypeError (#25369)
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 21fb90c3b4d..9f6e38a2e78 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -4142,7 +4142,7 @@ PHP_FUNCTION(imageaffine)
}
break;
default:
- zend_argument_type_error(3, "contains invalid type for element %i", i);
+ zend_argument_type_error(2, "contains invalid type for element %i", i);
RETURN_THROWS();
}
}
diff --git a/ext/gd/tests/imageaffine_element_type_error.phpt b/ext/gd/tests/imageaffine_element_type_error.phpt
new file mode 100644
index 00000000000..e4cf2cc4336
--- /dev/null
+++ b/ext/gd/tests/imageaffine_element_type_error.phpt
@@ -0,0 +1,15 @@
+--TEST--
+imageaffine(): the TypeError for an invalid element names the $affine argument
+--EXTENSIONS--
+gd
+--FILE--
+<?php
+$im = imagecreatetruecolor(20, 20);
+try {
+ imageaffine($im, [1, 0, null, 1, 0, 0]);
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+TypeError: imageaffine(): Argument #2 ($affine) contains invalid type for element 2