Skip to content

Commit 18a9ae4

Browse files
committed
Fix #77943: imageantialias($image, false); does not work
Firstly, we must not call `gdImageSetAntiAliased()` (which sets the color to anti-alias), but rather modify the `gdImage.AA` flag. Furthermore, we have to actually use the supplied boolean value. We also make sure that we don't attempt to enable anti-aliasing for palette images.
1 parent 3891e0d commit 18a9ae4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-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
@@ -4699,7 +4699,11 @@ PHP_FUNCTION(imageantialias)
46994699
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
47004700
RETURN_FALSE;
47014701
}
4702-
gdImageSetAntiAliased(im, 0);
4702+
4703+
if (im->trueColor) {
4704+
im->AA = alias;
4705+
}
4706+
47034707
RETURN_TRUE;
47044708
}
47054709
/* }}} */

0 commit comments

Comments
 (0)