ZF-10697: PDF generator with php 5.2.10 crashing when handling PNG files

Issue Type: Bug Created: 2010-11-17T07:00:28.000+0000 Last Updated: 2010-11-19T07:31:12.000+0000 Status: Resolved Fix version(s): - 1.11.1 (30/Nov/10)

Reporter: Henrik Sallander (hsallander) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Pdf

  • Zend_Search_Lucene

Related issues: Attachments:


I'm using the Zend Framework to generate PDF files, and in one of the support files for handling PNG-files there's a simple while-loop that the PHP version 5.2.10 fails to handle. It all worked fine before with the PHP version 5.1.6, but after upgrading to 5.2.10 it fails.

The line that fails is this simple line, Row 126: while(($chunkLengthBytes = fread($imageFile, 4)) !== false) { ... }

In the 5.1.* version this worked fine, the while loop exited correctly at the EOF of the PNG file. But in version 5.2.10-1 from the testing repo the loop continues to run, reading null values after the EOF and thus creating numerous other problems whithin the while loop..

The problem can be worked around by removing the "!== false" part, Row 126: while(($chunkLengthBytes = fread($imageFile, 4))) { ... }

Any ideas what could cause this? According to the php doc's their behaviour regarding exiting while-loops has not changed from what I can find.

The file in the Zend Framework that the loop is in is the following, Zend/Pdf/Resource/Image/Png.php

I have tried this with Zend Framework 1.7.1 (PHP 5.1.6 => works, PHP 5.2.10 => fails). I have also tried upgrading to ZF 1.10.6 but the issue remains.


Posted by Alexander Veremyev (alexander) on 2010-11-19T07:31:12.000+0000


Have you found an issue?

See the Overview section for more details.


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

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