php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28506 imagearc() doesn't like negative value of the s parameter
Submitted: 2004-05-24 14:49 UTC Modified: 2004-05-24 22:04 UTC
From: tony2001 at phpclub dot net Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5CVS-2004-05-24 (dev) OS: Linux 2.4.23
Private report: No CVE-ID: None
 [2004-05-24 14:49 UTC] tony2001 at phpclub dot net
Description:
------------
imagearc() draws broken arc, when using negative value as s parameter.
It could be GDlib bug, at least I found a couple of words in GD man: http://www.boutell.com/gd/manual2.0.23.html about unspecified bugs in gdImageArc().
Also, there can be simple workaround: just don't accept negative values, reduce them to zero.

Reproduce code:
---------------
// result image is here: http://tony2001.phpclub.net/temp/imagearc.png
//
// create a 200*200 image
$img = imagecreate(200, 200);

// allocate some colors
$white = imagecolorallocate($img, 255, 255, 255);
$black = imagecolorallocate($img, 0, 50, 200);
   
// draw a white circle 
imagearc($img, 100, 100, 150, 150, -1, 200, $black);

// output image in the browser
header("Content-type: image/png");
imagepng($img);
   
// free memory
imagedestroy($img);


Expected result:
----------------
a flat arc

Actual result:
--------------
a broken arc with some crosslines

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-24 22:04 UTC] pajoye@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

while (s < 0) s += 360 is used now.

--Pierre
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 20:01:29 2024 UTC