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

Bug #6085 Graph doesn't understand a numeric variable extracted from the GET method.
Submitted: 2005-11-27 05:28 UTC Modified: 2005-11-27 13:48 UTC
From: sonugill at sonugill dot com Assigned: nosey
Status: Closed Package: Image_Graph
PHP Version: 5.0.5 OS: Windows SERVER 2003
Roadmaps: (Not assigned)    

 [2005-11-27 05:28 UTC] sonugill at sonugill dot com
Description: ------------ PHP 5 IMAGE_GRAPH 0.7.1 I'm not sure if this a reported problem or not, but the issues seems to be of data type. I was using extracted $_GET variables to create my graph, but for some reason when passing in variables for width and height the graph class seemed to think there wasn't any width defined. This is the error I got in the browser. Error: Notice: Undefined variable: width in C:\PHP\PEAR\Image\Graph.php on line 176 The problem seems to be with the graph class not understanding $Width = '400' as the same as $Width = 400. //Error code $a = '400'; $b = '350'; Image_Graph::factory('graph', array($a, $b)); The above code produced the same error when using the GET array variables. Easy workaround for the above problem is to simply to do an add zero. //Working Code $a = '400' + 0; $b = '350' + 0; Image_Graph::factory('graph', array($a, $b)); Test script: --------------- if(isset($_GET['WID'])) $Width = $_GET['WID']; if(isset($_GET['HIT'])) $Height = $_GET['HIT']; Image_Graph::factory('graph', array($Width, $Height)); ... ... Expected result: ---------------- I expected the graph class to understand the variables I submited. Actual result: -------------- Notice: Undefined variable: width in C:\PHP\PEAR\Image\Graph.php on line 176


 [2005-11-27 13:48 UTC] nosey
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. This is due to the constructor having some pseudo-overloads, and the test for passing of (width, height) as parameters was done using is_int(), this has now been changed to is_numeric()