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

Bug #19954 GD version regex not correctly identifying 2.1.x
Submitted: 2013-05-22 04:57 UTC
From: adrianj Assigned:
Status: Open Package: Image_Canvas (version 0.3.5)
PHP Version: 5.4.15 OS: Debian
Roadmaps: (Not assigned)    
Subscription  


 [2013-05-22 04:57 UTC] adrianj (Adrian Jones)
Description: ------------ In the GD.php file, the _version function incorrectly identifies GD 2.1.0 (just released with PHP 5.4.15) as 1.x and so Image_Canvas no longer uses ImageCreateTrueColor which creates all sorts of PNG transparency and color issues. Can be easily fixed by changing the order of the checks so that 2.x is detected before. Although a more robust regex would be a better option. if (preg_match('/2\.[0-9]{1,2}/', $version)) { return 2; } elseif (preg_match('/1\.[0-9]{1,2}/', $version)) { return 1; } else { return 0; }

Comments

 [2013-06-29 11:50 UTC] doconnor (Daniel O'Connor)
Can I get you to send in a PR on github or upload a patch here?
 [2013-06-29 21:14 UTC] adrianbj (Adrian Jones)
Just submitted a PR using what I think should be a much more robust Regex
 [2013-10-10 16:21 UTC] lewar (Artur Lewandowski)
Thank you for a patch, at github repository https://github.com/pear/Image_Canvas/commit/d1d04703237c8865be9111cbe961fa9de37b180c It solves the problem with GD version 2.1. It is so important, that it's worth a new release of Image_Canvas.