php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79763 imagefilledarc fails with odd arc sizes
Submitted: 2020-07-01 10:23 UTC Modified: 2020-07-01 10:48 UTC
From: greg at subaqua dot co dot uk Assigned: cmb (profile)
Status: Not a bug Package: GD related
PHP Version: 7.2.31 OS: Ubuntu 18.04
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: greg at subaqua dot co dot uk
New email:
PHP Version: OS:

 

 [2020-07-01 10:23 UTC] greg at subaqua dot co dot uk
Description:
------------
When the arc size is specified as an ODD number of pixels, the arc angles are calculated incorrectly.

When specified as an EVEN number of pixels, it works OK.

See https://imgur.com/a/QCdscXj

The problem seems to be a combination of PHP version and GD version.

Fails: Ubuntu 18.04
PHP:7.2.24-0ubuntu0.18.04.6
GD: 2.2.5

Works: Redhat 7
PHP: 7.1.33
GD: 2.3


Test script:
---------------
<?php
$image_size = 400;
$arc_size   = $_GET['r'] ?? 275;

$image = imagecreate($image_size, $image_size);

$c1 = imagecolorallocate($image, 255, 255, 255);
$c2 = imagecolorallocate($image, 0, 255, 0);
$c3 = imagecolorallocate($image, 0, 0, 255);

imagefilledrectangle($image, 0, 0, $image_size, $image_size, $c1);

imagefilledarc($image, $image_size/2, $image_size/2, $arc_size, $arc_size, 135, 270, $c3, IMG_ARC_PIE);
imagefilledarc($image, $image_size/2, $image_size/2, $arc_size, $arc_size, 270, 405, $c2, IMG_ARC_PIE);

header('Content-type: image/png');
imagepng($image);
imagedestroy($image);



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-01 10:48 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-07-01 10:48 UTC] cmb@php.net
With regard to PHP this is a duplicate of bug #73614.

With regard to libgd this is a duplicate of
<https://github.com/libgd/libgd/issues/351> which is fixed as of
libgd 2.3.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC