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

Bug #15199 Zero value for y axis causes infinite loop
Submitted: 2008-12-01 18:39 UTC
From: blackbird88 Assigned:
Status: Open Package: Image_Graph (version CVS)
PHP Version: 5.2.6 OS: WIN32
Roadmaps: (Not assigned)    
Subscription  


 [2008-12-01 18:39 UTC] blackbird88 (Jerome Arfouche)
Description: ------------ in the list of values to be displayed on y axis, if ever there is a zero (so basically a point on the x axis) one of the modules goes into an infinite loop trying to divide by zero (i'm guessing to scale the y axis to the values used ) Test script: --------------- //explicitely hardcoded to test $Data->addPoint( 5 , 0 ) ; //add plot, add dataset and all the rest $Graph->Done() ; Expected result: ---------------- I expect to see a normal graph with a zero value for x=5 Actual result: -------------- Warning: Division by zero in C:\Program Files\graphpite\src\Graph\Axis.php on line 404

Comments

 [2008-12-06 13:11 UTC] doconnor (Daniel O'Connor)
Hey Jerome, care to expand out your test case so that it's executable?
 [2008-12-06 14:18 UTC] blackbird88 (Jerome Arfouche)
Well it seems it's due to something else, i've been working on it for a week now, and i don't think that's the reason anymore... but still the problem exists My test case is the following: I get a bunch of results from a db (the query was tested separately) and in a loop I add every pair of results as a point to a trivial dataset. Now sometimes the query returns no results (empty set) and that's when the module loops forever I think there should be some sort of try and catch if there are no values, or if one of them is null then exit instead of going ahead with the graphing I tried multi bar graphs, single bar graphs and line graphs they all crash. I tried putting the values into an array before feeding it to the dataset but that's no good either. I tried creating an array of datasets, still no good...