mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-10614: imagerotate will turn the picture all black, when rotated 90
This commit is contained in:
commit
b76ef301a0
2
NEWS
2
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)
|
||||
|
@ -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);
|
||||
|
93
ext/gd/tests/gh10614.phpt
Normal file
93
ext/gd/tests/gh10614.phpt
Normal file
@ -0,0 +1,93 @@
|
||||
--TEST--
|
||||
GH-10614 (imagerotate will turn the picture all black, when rotated 90)
|
||||
--EXTENSIONS--
|
||||
gd
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.4', '>=')) die("skip test requires GD 2.3.4 or older");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$input = imagecreatefrompng(__DIR__ . '/gh10614.png');
|
||||
|
||||
for ($angle = 0; $angle <= 270; $angle += 90) {
|
||||
echo "--- Angle $angle ---\n";
|
||||
$output = imagerotate($input, $angle, 0);
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
for ($j = 0; $j < 4; $j++) {
|
||||
var_dump(dechex(imagecolorat($output, $i, $j)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--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"
|
BIN
ext/gd/tests/gh10614.png
Normal file
BIN
ext/gd/tests/gh10614.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 98 B |
Loading…
Reference in New Issue
Block a user