Issues

ZF-8214: Checking for wrong gd_info() key, was renamed in PHP 5.3.0

Description

Zend_Pdf_Resource_Image_Jpeg::__construct() checks if the key "JPG Support" exists in the array returned by gd_info(). In PHP 5.3.0 "JPG Support" was renamed to "JPEG Support". This leads to the following error: "Undefined index: JPG Support in ...".

Also, the code, which should throw an Zend_Pdf_Exception if the index is not found, is never executed, because of the error. IMHO, this can easily be solved by using array_key_exists().

Although I'm referencing to 1.9.3PL1, this doesn't seem the be solved in trunk as well.

Cheers! Andreas

Patch: {{

Index: library/ZendFramework-1.9.3PL1/Zend/Pdf/Resource/Image/Jpeg.php

--- library/ZendFramework-1.9.3PL1/Zend/Pdf/Resource/Image/Jpeg.php (revision 5321) +++ library/ZendFramework-1.9.3PL1/Zend/Pdf/Resource/Image/Jpeg.php (working copy) @@ -58,7 +58,7 @@ }

     $gd_options = gd_info();

- if (!$gd_options['JPG Support'] ) { + if (!array_key_exists('JPG Support', $gd_options) && !array_key_exists('JPEG Support', $gd_options)) { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('JPG support is not configured properly.'); } }}

Comments

Fixed.