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

Request #4785 More descriptive error messages, use PEAR_Error or Exceptions
Submitted: 2005-07-11 07:41 UTC
From: nohn at php dot net Assigned:
Status: Open Package: Image_Graph
PHP Version: 5.0.4 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 23 - 6 = ?

 
 [2005-07-11 07:41 UTC] nohn at php dot net
Description: ------------ Initalize an Image_Graph (0.4.0) object fails Reproduce code: --------------- <?php require_once 'Image/Graph.php'; $graph = Image_Graph::factory('graph', 300, 100); $plotarea = $graph->addNew('plotarea'); $daten = Image_Graph::factory('dataset'); $daten->addPoint('Test', 43.0); $daten->addPoint('Hans', 23.0); $daten->addPoint('Wurst', 12.0); $plot = $plotarea->addNew('bar', $daten); $graph->done(); ?> Expected result: ---------------- A graph is painted. Actual result: -------------- [client 82.83.253.83] PHP Warning: imagecreatetruecolor() [<a href='function.imagecreatetruecolor'>function.imagecreatetruecolor</a>]: Invalid image dimensions in /opt/php/lib/php/Image/Graph/Driver/GD.php on line 177

Comments

 [2005-07-11 16:58 UTC] pear dot nosey at veggerby dot dk
This a bug in your graph :) The factory method takes as second parameter an array of parameters to pass to the constructor of the object. This means that you should simply change your code from: $graph = Image_Graph::factory('graph', 300, 100); to $graph = Image_Graph::factory('graph', array(300, 100)); And you should get the expected result. regards Jesper
 [2005-07-12 07:42 UTC] nohn
Right. It was my fault, thank you. Anyway: Should'nt there be a more descriptive error message? And: It should definitly raise a PEAR_Error or Exception, so make this a feature request.
 [2005-07-27 21:17 UTC] pear dot nosey at veggerby dot dk
Well I guess that's a good idea - you know it's just one of these things that are at the end of the list (and seem to stay there :)) regards Jesper
 [2006-06-17 16:50 UTC] till (till)
I just spent an hour with a similar problem. :/ I really love this package despite the missing error handling, would you like some support on moving to Pear_Error?