Issues

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

Issue Type: Bug Created: 2009-11-04T03:58:46.000+0000 Last Updated: 2009-11-19T07:06:43.000+0000 Status: Resolved Fix version(s): - 1.9.6 (24/Nov/09)

Reporter: Andreas Baumgart (polycaster) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Pdf

Related issues: - ZF-7818

Attachments: - ZF-8214.patch

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

Posted by Alexander Veremyev (alexander) on 2009-11-19T07:06:43.000+0000

Fixed.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts