Home » Images » Image_Graph » Bug #6085
Graph doesn't understand a numeric variable extracted from the GET method.
Details
| Submitted | 2005-11-27 10:28 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) |
Comments
[2005-11-27 10: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