php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #847 imagearc fails with arc from 0 to 360 degrees
Submitted: 1998-10-15 02:14 UTC Modified: 1998-11-13 13:46 UTC
From: leon at clearink dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.5 OS: Solaris and Windows NT
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: leon at clearink dot com
New email:
PHP Version: OS:

 

 [1998-10-15 02:14 UTC] leon at clearink dot com
The following script creates a solid black circle in PHP 3.0.4, but in 3.0.5 the call to imagearc fails.  

It appears I can draw an arc of at most 360 degrees, which is insufficent for creating a closed loop on circles with diameters bigger than about 200 pixels.  Looks like an off-by-one bug.


<?
	$ChartDiameter = 300;
	$ChartWidth = $ChartDiameter + 20;
	$ChartHeight = $ChartDiameter + 20 +
		(($ChartFontHeight + 2) * 
                  count($ChartData));
	$ChartCenterX = $ChartDiameter/2 + 10;
	$ChartCenterY = $ChartDiameter/2 + 10;
	
	//create image
	$image = imagecreate($ChartWidth, $ChartHeight);

	//allocate colors
	$colorBody = imagecolorallocate($image, 0xFF, 
         0xFF, 0xFF);
	$colorBorder = imagecolorallocate($image, 0x00, 
            0x00, 0x00);

	//fill background
	imagefill($image, 0, 0, $colorBody);

	//draw border
	imagearc($image, 
		$ChartCenterX, 
		$ChartCenterY,
		$ChartDiameter+7, 
		$ChartDiameter+7, 
		0, 
		360, 
		$colorBorder);


	imagefilltoborder($image, 
		$ChartCenterX, 
		$ChartCenterY, 
		$colorBorder, 
		$colorBorder);

	
	//output image
	header("Content-type: image/gif");
	imagegif($image);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-11-13 13:46 UTC] ssb
PHP did a modulo 360 operation on the angles that was a
bit premature (was once added to deal with negative angles).
Should be fixed in revision 1.100 of functions/gd.c.  Thanks.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 19:01:36 2025 UTC