Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ PHP NEWS
. Fixed a use-after-free when cloning a DOMNameSpaceNode after
DOMDocument::xinclude(). (iliaal)

- GD:
. Fixed imageaffinematrixget() and imageaffinematrixconcat() reporting the
wrong argument in error messages. (Weilin Du)

- Intl:
. Fixed a double-free when IntlGregorianCalendar construction fails after
the ICU constructor adopts the TimeZone. (iliaal)
Expand Down
4 changes: 2 additions & 2 deletions ext/gd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4210,7 +4210,7 @@ PHP_FUNCTION(imageaffinematrixget)
case GD_AFFINE_SCALE: {
double x, y;
if (Z_TYPE_P(options) != IS_ARRAY) {
zend_argument_type_error(1, "must be of type array when using translate or scale");
zend_argument_type_error(2, "must be of type array when using translate or scale");
RETURN_THROWS();
}

Expand Down Expand Up @@ -4291,7 +4291,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
}

if (zend_hash_num_elements(Z_ARRVAL_P(z_m2)) != 6) {
zend_argument_value_error(1, "must have 6 elements");
zend_argument_value_error(2, "must have 6 elements");
RETURN_THROWS();
}

Expand Down
4 changes: 2 additions & 2 deletions ext/gd/tests/bug67248.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ for($i=0;$i<7;$i++) {
}
?>
--EXPECTF--
!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
!! [TypeError] imageaffinematrixget(): Argument #1 ($type) must be of type array when using translate or scale
!! [TypeError] imageaffinematrixget(): Argument #2 ($options) must be of type array when using translate or scale
!! [TypeError] imageaffinematrixget(): Argument #2 ($options) must be of type array when using translate or scale

Warning: Object of class stdClass could not be converted to float in %s on line %d
array(6) {
Expand Down
14 changes: 14 additions & 0 deletions ext/gd/tests/imageaffinematrixconcat_error.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
imageaffinematrixconcat() reports the correct argument for an invalid matrix size
--EXTENSIONS--
gd
--FILE--
<?php
try {
imageaffinematrixconcat([1, 0, 0, 1, 0, 0], []);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
ValueError: imageaffinematrixconcat(): Argument #2 ($matrix2) must have 6 elements
Loading