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


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.