File tree 4 files changed +29
-0
lines changed
4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ PHP NEWS
18
18
. Fixed bug GH-17609 (Typo in error message: Dom\NO_DEFAULT_NS instead of
19
19
Dom\HTML_NO_DEFAULT_NS). (nielsdos)
20
20
21
+ - GD:
22
+ . Fixed bug GH-17703 (imagescale with both width and height negative values
23
+ triggers only an Exception on width). (David Carlier)
24
+
21
25
- MBString:
22
26
. Fixed bug GH-17503 (Undefined float conversion in mb_convert_variables).
23
27
(cmb)
Original file line number Diff line number Diff line change @@ -627,6 +627,9 @@ PHP 8.4 UPGRADE NOTES
627
627
. DOMDocument::registerNodeClass() now has a tentative return type of true.
628
628
Previously, the return type was bool but only true could be returned in practice.
629
629
630
+ - GD:
631
+ . imagescale now throws a ValueError when both width and height arguments are negative.
632
+
630
633
- Hash:
631
634
. Changed the return type of hash_update() to true. It was already the case that only
632
635
true could be returned, but the stub was not updated yet.
Original file line number Diff line number Diff line change @@ -3981,6 +3981,11 @@ PHP_FUNCTION(imagescale)
3981
3981
3982
3982
im = php_gd_libgdimageptr_from_zval_p (IM );
3983
3983
3984
+ if (tmp_h < 0 && tmp_w < 0 ) {
3985
+ zend_value_error ("Argument #2 ($width) and argument #3 ($height) cannot be both negative" );
3986
+ RETURN_THROWS ();
3987
+ }
3988
+
3984
3989
if (tmp_h < 0 || tmp_w < 0 ) {
3985
3990
/* preserve ratio */
3986
3991
long src_x , src_y ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-17703 both width and height value being negative triggers ValueError on width.
3
+ --EXTENSIONS--
4
+ gd
5
+ --FILE--
6
+ <?php
7
+
8
+ $ img = imagecreatetruecolor ( 256 , 1 );
9
+
10
+ try {
11
+ imagescale ($ img , -1 , -1 , 0 );
12
+ } catch (\ValueError $ e ) {
13
+ echo $ e ->getMessage ();
14
+ }
15
+ ?>
16
+ --EXPECT--
17
+ Argument #2 ($width) and argument #3 ($height) cannot be both negative
You can’t perform that action at this time.
0 commit comments