[php-src] PHP-8.4: Fix the argument named by the imageaffine() element TypeError (#25369)
| From: | Louis-Arnaud via GitHub | Date: | Tue, 10 Nov 2026 15:38:26 +0000 |
| Subject: | [php-src] PHP-8.4: Fix the argument named by the imageaffine() element TypeError (#25369) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143535@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: TimWolla
Date: 2026-11-10T16:38:22+01:00
Commit: https://github.com/php/php-src/commit/b6df294ee073e61411f4dd91e07f7115d435fb5d
Raw diff: https://github.com/php/php-src/commit/b6df294ee073e61411f4dd91e07f7115d435fb5d.diff
Fix the argument named by the imageaffine() element TypeError (#25369)
Changed paths:
A ext/gd/tests/imageaffine_element_type_error.phpt
M ext/gd/gd.c
Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 21fb90c3b4d1..9f6e38a2e78d 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 000000000000..e4cf2cc4336f
--- /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