From ba7c3a1bb40c4c087436a230dd7372ff9b6413d8 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 12 Jul 2015 16:26:16 +0200 Subject: [PATCH 1/2] Fix #68714: copy 'n paste error Actually, this is not really a bug fix, but rather a simplification and optimization in the same vein as has been done with the external libgd, but going a small step further and joining both for loops. --- ext/gd/libgd/gd_arc.c | 8 +------ ext/gd/tests/imagefilledellipse_basic.phpt | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 ext/gd/tests/imagefilledellipse_basic.phpt diff --git a/ext/gd/libgd/gd_arc.c b/ext/gd/libgd/gd_arc.c index 545dcb3fc5a..1c748713888 100644 --- a/ext/gd/libgd/gd_arc.c +++ b/ext/gd/libgd/gd_arc.c @@ -58,7 +58,7 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c) int x=0,mx1=0,mx2=0,my1=0,my2=0; long aq,bq,dx,dy,r,rx,ry,a,b; int i; - int old_y1,old_y2; + int old_y2; a=w>>1; b=h>>1; @@ -79,7 +79,6 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c) ry = 0; x = a; old_y2=-2; - old_y1=-2; while (x > 0){ if (r > 0) { my1++;my2--; @@ -95,15 +94,10 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c) if(old_y2!=my2){ for(i=mx1;i<=mx2;i++){ gdImageSetPixel(im,i,my1,c); - } - } - if(old_y2!=my2){ - for(i=mx1;i<=mx2;i++){ gdImageSetPixel(im,i,my2,c); } } old_y2 = my2; - old_y1 = my1; } } diff --git a/ext/gd/tests/imagefilledellipse_basic.phpt b/ext/gd/tests/imagefilledellipse_basic.phpt new file mode 100644 index 00000000000..a1a578ad43f --- /dev/null +++ b/ext/gd/tests/imagefilledellipse_basic.phpt @@ -0,0 +1,25 @@ +--TEST-- +Testing imagefilledellipse() of GD library +--SKIPIF-- + +--FILE-- + +--EXPECT-- +9ba540bba1b78c9f08efaa6fa0afd93b From c0ac51dc07fac16d72a0b05b4dc70e944e66ffd8 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 12 Jul 2015 16:38:23 +0200 Subject: [PATCH 2/2] updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 5e86ea1fbd8..6d9dd15ae1c 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ PHP NEWS . Fixed bug #64878 (304 responses return Content-Type header). (cmb) - GD: + . Fixed bug #68714 (copy 'n paste error). (cmb) . Fixed bug #66339 (PHP segfaults in imagexbm). (cmb) . Fixed bug #70047 (gd_info() doesn't report WebP support). (cmb)