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

Bug #9070 factory method causes PHP error if no GD
Submitted: 2006-10-17 20:41 UTC
From: ftzdomino Assigned: nosey
Status: Closed Package: Image_Canvas (version 0.3.0)
PHP Version: 5.1.4 OS: OSX 10.4.8
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 : 37 - 33 = ?

 
 [2006-10-17 20:41 UTC] ftzdomino (Jon Snell)
Description: ------------ Using the factory method with error_reporting(E_ALL) and without GD installed causes the following errors: Notice: Undefined variable: version in /sw/lib/php/Image/Canvas/GD.php on line 1682 Notice: Undefined variable: version in /sw/lib/php/Image/Canvas/GD.php on line 1684 Fatal error: Call to undefined function ImageCreate() in /sw/lib/php/Image/Canvas/GD.php on line 169 This is because $version is not set if (ereg("<td[^>]*>GD Version *<\/td><td[^>]*>([^<]*)<\/td>", $php_info, $result) does not match anything. This string does match anything in the return php_info since GD is not installed. Test script: --------------- (without GD installed) <?php include('Image/Canvas.php'); error_reporting(E_ALL); Image_Canvas::factory('png', array('width' => 800, 'height' => 400)); ?> Expected result: ---------------- function _version() should return 0 when GD is not installed, as described by the function documentation, allowing it to fail in a better way Actual result: -------------- Notice: Undefined variable: version in /sw/lib/php/Image/Canvas/GD.php on line 1682 Notice: Undefined variable: version in /sw/lib/php/Image/Canvas/GD.php on line 1684 Fatal error: Call to undefined function ImageCreate() in /sw/lib/php/Image/Canvas/GD.php on line 169

Comments

 [2006-10-24 19:00 UTC] nosey (Jesper Veggerby)
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. Patches applied - thanks to troehr at php dot net