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

Bug #8840 Undefined local variable resultImage
Submitted: 2006-10-03 09:00 UTC Modified: 2006-10-03 09:21 UTC
From: rumata at php dot net Assigned: firman
Status: Closed Package: Image_Tools (version 0.3.0)
PHP Version: Irrelevant OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2006-10-03 09:00 UTC] rumata at php dot net (Ildar Shaimordanov)
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

Comments

 [2006-10-03 09:21 UTC] firman (Firman Wandayandi)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net 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.