Skip to content

Commit 3fc1bdc

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #77943: imageantialias($image, false); does not work
2 parents ff2b5bd + cd94cf6 commit 3fc1bdc

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ PHP NEWS
55
- FPM:
66
. Fixed bug #77921 (static.php.net doesn't work anymore). (Peter Kokot)
77

8+
- GD:
9+
. Fixed bug #77943 (imageantialias($image, false); does not work). (cmb)
10+
811
- JSON:
912
. Fixed bug #77843 (Use after free with json serializer). (Nikita)
1013

ext/gd/gd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4623,7 +4623,11 @@ PHP_FUNCTION(imageantialias)
46234623
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
46244624
RETURN_FALSE;
46254625
}
4626-
gdImageSetAntiAliased(im, 0);
4626+
4627+
if (im->trueColor) {
4628+
im->AA = alias;
4629+
}
4630+
46274631
RETURN_TRUE;
46284632
}
46294633
/* }}} */

ext/gd/tests/bug77943.phpt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Bug #77943 (imageantialias($image, false); does not work)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
require_once __DIR__ . '/func.inc';
10+
11+
$width = 400;
12+
$height = 300;
13+
$im = imagecreatetruecolor($width, $height);
14+
$white = imagecolorallocate($im, 255, 255, 255);
15+
$blue = imagecolorallocate($im, 0, 0, 255);
16+
17+
imageantialias($im, false);
18+
imagefilledrectangle($im, 0, 0, $width-1, $height-1, $white);
19+
20+
imageline($im, 0, 0, $width, $height, $blue);
21+
imagesetthickness($im, 3);
22+
imageline($im, 10, 0, $width, $height-10, $blue);
23+
24+
test_image_equals_file(__DIR__ . '/bug77943.png', $im);
25+
?>
26+
===DONE===
27+
--EXPECT--
28+
The images are equal.
29+
===DONE===

ext/gd/tests/bug77943.png

2.14 KB
Loading

0 commit comments

Comments
 (0)