Zend Framework

Checking for wrong gd_info() key, was renamed in PHP 5.3.0

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.3
  • Fix Version/s: 1.9.6
  • Component/s: Zend_Pdf
  • Labels:
    None

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'] )
    Unknown macro: {+ 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.'); }}}

Issue Links

Activity

Hide
Alexander Veremyev added a comment -

Fixed.

Show
Alexander Veremyev added a comment - Fixed.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: