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  


 [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