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

Issue Type: Bug Created: 2009-07-01T18:32:52.000+0000 Last Updated: 2012-11-20T20:53:23.000+0000 Status: Closed Fix version(s): Reporter: Chris Hiestand (dimmer) Assignee: None Tags: - Zend_Pdf

Related issues: - ZF-7177

Attachments: - Monte Carlo Model of Background Glutamate Spillover in the Hippocampus 2004-3291.pdf


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


Posted by Chris Hiestand (dimmer) on 2009-07-01T18:33:25.000+0000

PDF File with which to reproduce the bug.

Posted by Chris Hiestand (dimmer) on 2009-07-01T18:34:20.000+0000

Suggested patch, created with svn diff.

Posted by Chris Hiestand (dimmer) on 2009-07-01T18:34:58.000+0000

PHP script sufficient to reproduce the problem

Posted by Rob Allen (rob) on 2012-11-20T20:53:23.000+0000

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.

Have you found an issue?

See the Overview section for more details.


© 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.