Skip to content

Commit

Permalink
Fix #77943: imageantialias($image, false); does not work
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmb69 committed Apr 29, 2019
1 parent 3891e0d commit 18a9ae4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PHP NEWS
- FPM:
. Fixed bug #77921 (static.php.net doesn't work anymore). (Peter Kokot)

- GD:
. Fixed bug #77943 (imageantialias($image, false); does not work). (cmb)

- JSON:
. Fixed bug #77843 (Use after free with json serializer). (Nikita)

Expand Down
6 changes: 5 additions & 1 deletion ext/gd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4699,7 +4699,11 @@ PHP_FUNCTION(imageantialias)
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
RETURN_FALSE;
}
gdImageSetAntiAliased(im, 0);

if (im->trueColor) {
im->AA = alias;
}

RETURN_TRUE;
}
/* }}} */
Expand Down

0 comments on commit 18a9ae4

Please sign in to comment.