Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.0

Bug #4113 Image_Graph_Driver_GD::pieSlice() warnings
Submitted: 2005-04-11 04:40 UTC
From: aharvey at optimiser dot com Assigned: nosey
Status: Closed Package: Image_Graph
PHP Version: 5.0.3 OS: Any
Roadmaps: (Not assigned)    
Subscription  


 [2005-04-11 04:40 UTC] aharvey at optimiser dot com
Description: ------------ Not enough points are generated within the $polygon array in Image_Graph_Driver_GD::pieSlice() when a pie slice has 0 width. A patch addressing this against 0.3.0 is available at http://lawngnome.cernun.net/junk/pieSlice.diff Reproduce code: --------------- <?php include_once 'Image/Graph.php'; error_reporting(E_ALL); $graph = Image_Graph::factory('graph', array(640, 480)); $plotarea = $graph->addNew('plotarea'); $plotarea->hideAxis(); $dataset = Image_Graph::factory('Image_Graph_Dataset_Trivial'); $dataset->addPoint(1, 1); $dataset->addPoint(2, 2); $dataset->addPoint(3, 0); $plot = $plotarea->addNew('Image_Graph_Plot_Pie', $dataset); $plot->setLineColor('black'); $fillstyle = Image_Graph::factory('Image_Graph_Fill_Array'); $fillstyle->addColor('red'); $fillstyle->addColor('green'); $fillstyle->addColor('blue'); $plot->setFillStyle($fillstyle); $graph->done(); ?> Expected result: ---------------- A graph should appear with two visible slices, as the third slice has zero width. Actual result: -------------- The graph is generated, but the following warnings appear before the graph data: Warning: imagefilledpolygon() [function.imagefilledpolygon]: You must have at least 3 points in your array in /usr/share/pear/Image/Graph/Driver/GD.php on line 964 Warning: imagepolygon() [function.imagepolygon]: You must have at least 3 points in your array in /usr/share/pear/Image/Graph/Driver/GD.php on line 968 This is caused by the $polygon array having only four elements instead of the required six.

Comments

 [2005-04-17 06:44 UTC] pear dot nosey at veggerby dot dk
Thanks for your input and your patch. I will apply it at the first given opportunity. /Jesper
 [2005-05-17 21:15 UTC] pear dot nosey at veggerby dot dk
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.