php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50036 imagefilledarc ignores angle when start and end are the same
Submitted: 2009-10-29 16:46 UTC Modified: 2015-06-29 20:02 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: gavin dot miller at areva-td dot com Assigned: cmb (profile)
Status: Not a bug Package: GD related
PHP Version: 5.2.11 OS: Windows XP
Private report: No CVE-ID: None
 [2009-10-29 16:46 UTC] gavin dot miller at areva-td dot com
Description:
------------
When doing a imagefilledarc where the start and end angle are the same 
the angle is ignored and zero is used instead.

Just upgraded from PHP 5.1.4 to 5.2.11 
Using 5.1.4 the function would correctly position a line at the request 
angle with 5.2.11 zero is always used.

the start and end must be at least 1 degree different to produce the 
correct result.

Reproduce code:
---------------
---
From manual page: function.imagefilledarc#Description
---

<?php
$img = imagecreate(200, 200);
$white = imagecolorallocate($img, 255, 255, 255);
$blue = imagecolorallocate($img, 153, 204, 255);
$black = imagecolorallocate($img, 0, 0, 0);
imagefilledarc($img, 100, 100, 175, 175,0,360, $blue,IMG_ARC_PIE);
imagefilledarc($img, 100, 100, 175, 175, 150,150, $black,IMG_ARC_PIE|IMG_ARC_NOFILL |IMG_ARC_EDGED);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>


Expected result:
----------------
blue circle with black line drawn at 150degrees

Actual result:
--------------
blue circle with black line drawn at 0degrees

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-08 12:04 UTC] felipe@php.net
This looks like was introduced by libgd/gd.c:rev.237682 (- Fixed regression introduced by the fix for the libgd bug#74)
 [2015-06-29 20:02 UTC] cmb@php.net
-Status: Assigned +Status: Not a bug -Assigned To: pajoye +Assigned To: cmb
 [2015-06-29 20:02 UTC] cmb@php.net
This is not a bug, but rather a deliberate design decision.
Drawing an arc of 0° does not really make sense, because there's
nothing to be drawn, so this case is treated as an arc of 360° has
been requested[1].

The strange result is due to the use of IMG_ARC_NOFILL, by the
way; if this option is not given, a full black circle is drawn.

[1] <https://github.com/php/php-src/blob/php-5.6.10/ext/gd/libgd/gd.c#L1685-L1686>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 01:01:31 2024 UTC