Issues

ZF-7178: ZendPDF::save() may fail when mb_detect_encoding returns false

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

Comments

PDF File with which to reproduce the bug.

Suggested patch, created with svn diff.

PHP script sufficient to reproduce the problem

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.