Home » Images » Image_Tools » Bug #8840
Undefined local variable resultImage
Details
| Submitted | 2006-10-03 14:00 UTC |
|---|---|
| From | rumata at php dot net |
| Assigned | firman |
| Status | Closed |
| Package | Image_Tools |
| PHP Version | Irrelevant |
| OS | irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2006-10-03 14:00 UTC] rumata at php dot net
Description:
------------
Illegal usage of the local variable $resultImage in 'Image_Tools::display' and 'Image_Tools::save' methods
at Image/Tools.php
When using Image::Tools package with any mistakes (for example: passing filename of non-existent image)
Actual lines are
657: return PEAR::raiseError('Error rendering: ' . $resultImage->getMessage());
705: return PEAR::raiseError('Error rendering: ' . $resultImage->getMessage());
IMHO, they must be
657: return PEAR::raiseError('Error rendering: ' . $res->getMessage());
705: return PEAR::raiseError('Error rendering: ' . $res->getMessage());
Test script:
---------------
<?php
// Modified example from the package
require_once 'Image/Tools.php';
$options = array('image' => 'non-existent-path/pear.png');
$tool =& Image_Tools::factory('swap', $options);
if (PEAR::isError($tool)) { die($tool->toString()); }
$err = $tool->display();
if (PEAR::isError($err)) { die($err->toString()); }
?>
Expected result:
----------------
[pear_error: message="Error rendering: Failed to create image from string data" code=0 mode=return level=notice prefix="" info=""]
Actual result:
--------------
Warning: imagecreatefromstring() [function.imagecreatefromstring]: Data is not in a recognized format. in z:\home\localhost\www\Image\Tools.php on line 542
Notice: Undefined variable: resultImage in z:\home\localhost\www\Image\Tools.php on line 657
Fatal error: Call to a member function getMessage() on a z:\home\localhost\www\Image\Tools.php on line 657