php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64641 imagefilledpolygon doesn't draw horizontal line
Submitted: 2013-04-12 19:08 UTC Modified: 2016-06-20 12:46 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: temposeb at free dot fr Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 5.6.11 OS: *
Private report: No CVE-ID: None
 [2013-04-12 19:08 UTC] temposeb at free dot fr
Description:
------------
At worst imagefilledpolygon( ) doesn't render at all object composed exclusively 
of horizontal lines. No problem with vertical/diagonal lines or imagepolygon( ).

Test script:
---------------
$image = imagecreatetruecolor(640, 480) ;

// Vertical line, drawn
$points = array(100, 100, 100, 200, 100, 300) ;
imagefilledpolygon($image, $points, 3, 0xFFFF00) ;

// Horizontal line, not drawn
$points = array(300, 200, 400, 200, 500, 200) ;
imagefilledpolygon($image, $points, 3, 0xFFFF00) ;

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


Expected result:
----------------
Two objects rendered : 1 vertical line, 1 horizontal line.

Actual result:
--------------
One object rendered : 1 vertical line.

Patches

git-am (last revision 2015-07-20 22:06 UTC by cmb@php.net)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-20 22:06 UTC] cmb@php.net
The following patch has been added/updated:

Patch Name: git-am
Revision:   1437430006
URL:        https://bugs.php.net/patch-display.php?bug=64641&patch=git-am&revision=1437430006
 [2015-07-20 22:08 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Operating System: Win XP Pro SP3 +Operating System: * -PHP Version: 5.3.24 +PHP Version: 5.6.11 -Assigned To: +Assigned To: cmb
 [2015-07-20 22:08 UTC] cmb@php.net
I can confirm this issue. The solution would be simple: just
handle the special case of 1D polygons by delegating to
gdImagePolygon(); there's nothing to fill anyway.

The attached patch "git-am" does this, but it also breaks several
PHPTs. This demands further investigation on whether this is
caused by major behavioral changes (it doesn't appear so), and
maybe some discussion.
 [2016-06-19 15:10 UTC] cmb@php.net
-Status: Analyzed +Status: Suspended
 [2016-06-19 15:10 UTC] cmb@php.net
Update: I've submitted an improved PR against libgd
(https://github.com/libgd/libgd/pull/236). Until this
is resolved, I suspend this ticket.
 [2016-06-20 12:46 UTC] cmb@php.net
-Status: Suspended +Status: Re-Opened
 [2016-06-20 12:46 UTC] cmb@php.net
The libgd PR has been merged, so I'm re-opening.
 [2016-06-20 13:41 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4b4275059fd3d7f0840d238a92d8cd0cfe3292eb
Log: Fix #64641: imagefilledpolygon doesn't draw horizontal line
 [2016-06-20 13:41 UTC] cmb@php.net
-Status: Re-Opened +Status: Closed
 [2016-06-20 13:43 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4b4275059fd3d7f0840d238a92d8cd0cfe3292eb
Log: Fix #64641: imagefilledpolygon doesn't draw horizontal line
 [2016-06-22 05:58 UTC] krakjoe@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4b4275059fd3d7f0840d238a92d8cd0cfe3292eb
Log: Fix #64641: imagefilledpolygon doesn't draw horizontal line
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC