diff --git a/NEWS b/NEWS index 8c127acf33b..9738d0ace16 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,8 @@ PHP NEWS - GD: . Fixed bug GH-10344 (imagettfbbox(): Could not find/open font UNC path). (nielsdos) + . Fixed bug GH-10614 (imagerotate will turn the picture all black, when + rotated 90). (nielsdos) - LibXML: . Fix crashes with entity references and predefined entities. (nielsdos) diff --git a/ext/gd/libgd/gd_rotate.c b/ext/gd/libgd/gd_rotate.c index cc89652f03f..53c6c9470db 100644 --- a/ext/gd/libgd/gd_rotate.c +++ b/ext/gd/libgd/gd_rotate.c @@ -216,7 +216,7 @@ gdImagePtr gdImageRotate90 (gdImagePtr src, int ignoretransparent) if (dst != NULL) { int old_blendmode = dst->alphaBlendingFlag; dst->alphaBlendingFlag = 0; - + dst->saveAlphaFlag = 1; dst->transparent = src->transparent; gdImagePaletteCopy (dst, src); @@ -263,7 +263,7 @@ gdImagePtr gdImageRotate180 (gdImagePtr src, int ignoretransparent) if (dst != NULL) { int old_blendmode = dst->alphaBlendingFlag; dst->alphaBlendingFlag = 0; - + dst->saveAlphaFlag = 1; dst->transparent = src->transparent; gdImagePaletteCopy (dst, src); @@ -311,7 +311,7 @@ gdImagePtr gdImageRotate270 (gdImagePtr src, int ignoretransparent) if (dst != NULL) { int old_blendmode = dst->alphaBlendingFlag; dst->alphaBlendingFlag = 0; - + dst->saveAlphaFlag = 1; dst->transparent = src->transparent; gdImagePaletteCopy (dst, src); diff --git a/ext/gd/tests/gh10614.phpt b/ext/gd/tests/gh10614.phpt new file mode 100644 index 00000000000..c0689141837 --- /dev/null +++ b/ext/gd/tests/gh10614.phpt @@ -0,0 +1,93 @@ +--TEST-- +GH-10614 (imagerotate will turn the picture all black, when rotated 90) +--EXTENSIONS-- +gd +--SKIPIF-- +=')) die("skip test requires GD 2.3.4 or older"); +?> +--FILE-- + +--EXPECT-- +--- Angle 0 --- +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +--- Angle 90 --- +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +--- Angle 180 --- +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +--- Angle 270 --- +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" +string(1) "0" +string(1) "0" +string(8) "7f000000" +string(8) "7f000000" diff --git a/ext/gd/tests/gh10614.png b/ext/gd/tests/gh10614.png new file mode 100644 index 00000000000..baf1ea92fc9 Binary files /dev/null and b/ext/gd/tests/gh10614.png differ