Skip to content

Commit 213ad54

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #51498: imagefilledellipse does not work for large circles
2 parents 940c353 + c565555 commit 213ad54

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ PHP NEWS
1515
- CGI:
1616
. Fixed bug #80849 (HTTP Status header truncation). (cmb)
1717

18+
- GD:
19+
. Fixed bug #51498 (imagefilledellipse does not work for large circles). (cmb)
20+
1821
- Opcache:
1922
. Fixed bug #81225 (Wrong result with pow operator with JIT enabled).
2023
(Dmitry)

ext/gd/libgd/gd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
17151715
void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
17161716
{
17171717
int x=0,mx1=0,mx2=0,my1=0,my2=0;
1718-
long aq,bq,dx,dy,r,rx,ry,a,b;
1718+
int64_t aq,bq,dx,dy,r,rx,ry,a,b;
17191719

17201720
a=w>>1;
17211721
b=h>>1;
@@ -1754,7 +1754,7 @@ void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
17541754
void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
17551755
{
17561756
int x=0,mx1=0,mx2=0,my1=0,my2=0;
1757-
long aq,bq,dx,dy,r,rx,ry,a,b;
1757+
int64_t aq,bq,dx,dy,r,rx,ry,a,b;
17581758
int i;
17591759
int old_y2;
17601760

ext/gd/tests/bug51498.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #51498 (imagefilledellipse does not work for large circles)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die("skip gd extension not available");
6+
if (!GD_BUNDLED && version_compare(GD_VERSION, "2.3.0") < 0) {
7+
die("skip test requires GD 2.3.0 or higher");
8+
}
9+
?>
10+
--FILE--
11+
<?php
12+
$img = imagecreatetruecolor(2200, 2200);
13+
$white = imagecolorallocate($img, 255, 255, 255);
14+
imagefilledellipse($img, 1100, 1100, 2200, 2200, $white);
15+
16+
require_once __DIR__ . '/func.inc';
17+
test_image_equals_file(__DIR__ . '/bug51498_exp.png', $img);
18+
?>
19+
--EXPECT--
20+
The images are equal.

ext/gd/tests/bug51498_exp.png

27 KB
Loading

0 commit comments

Comments
 (0)