Zend Framework

ZendPDF::save() may fail when mb_detect_encoding returns false

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.8.4
  • Fix Version/s: None
  • Component/s: Zend_Pdf
  • Labels:
    None

Description

When saving a PDF with improperly encoded data, mb_detect_encoding() can return boolean false, which Zend_PDF::render() does not expect. This causes mb_convert_encoding to fail with Warning:
Warning at /www/ZendFramework/library/Zend/Pdf.php:737: mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified

In my experience improperly encoded PDFs are ubiquitous, so Zend_PDF should be able to handle them instead of expecting the input data to be perfect.

Attached is a patch for how I believe a failed mb_detect_encoding() should be handled, and files to reproduce the problem.

Zend Issue #ZF-7177 also applies here

  1. Monte Carlo Model of Background Glutamate Spillover in the Hippocampus 2004-3291.pdf
    01/Jul/09 6:33 PM
    1.49 MB
    Chris Hiestand
  2. patch.diff
    01/Jul/09 6:34 PM
    0.6 kB
    Chris Hiestand
  3. reproduce.php
    01/Jul/09 6:34 PM
    0.4 kB
    Chris Hiestand

Issue Links

Activity

Hide
Chris Hiestand added a comment -

PDF File with which to reproduce the bug.

Show
Chris Hiestand added a comment - PDF File with which to reproduce the bug.
Hide
Chris Hiestand added a comment -

Suggested patch, created with svn diff.

Show
Chris Hiestand added a comment - Suggested patch, created with svn diff.
Hide
Chris Hiestand added a comment -

PHP script sufficient to reproduce the problem

Show
Chris Hiestand added a comment - PHP script sufficient to reproduce the problem

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: