Skip to content

Commit

Permalink
Merge branch 'PHP-7.2' into PHP-7.3
Browse files Browse the repository at this point in the history
* PHP-7.2:
  Fix #77943: imageantialias($image, false); does not work
  • Loading branch information
cmb69 committed Apr 29, 2019
2 parents ff2b5bd + cd94cf6 commit 3fc1bdc
Show file tree
Hide file tree
Showing 4 changed files with 37 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 @@ -4623,7 +4623,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
29 changes: 29 additions & 0 deletions ext/gd/tests/bug77943.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
Bug #77943 (imageantialias($image, false); does not work)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
require_once __DIR__ . '/func.inc';

$width = 400;
$height = 300;
$im = imagecreatetruecolor($width, $height);
$white = imagecolorallocate($im, 255, 255, 255);
$blue = imagecolorallocate($im, 0, 0, 255);

imageantialias($im, false);
imagefilledrectangle($im, 0, 0, $width-1, $height-1, $white);

imageline($im, 0, 0, $width, $height, $blue);
imagesetthickness($im, 3);
imageline($im, 10, 0, $width, $height-10, $blue);

test_image_equals_file(__DIR__ . '/bug77943.png', $im);
?>
===DONE===
--EXPECT--
The images are equal.
===DONE===
Binary file added ext/gd/tests/bug77943.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3fc1bdc

Please sign in to comment.