Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct()

In one of our Magento projects, on development environment everything was working fine but when the site was live “Invoice” print in magento admin [ Admin >> Sales >> Orders >> Invoice tab >> Open Invoice >> Click print button] was giving Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct().

We though that we might have missed some file when moving to live site but ultimately we found that code base was same. After doing some research we found that it was an environment issue. On development environment we were running PHP version 5.3.5 while on live we were running PHP version 5.4.5. The current version of Zend Library used in magento is not compatible with stricter inheritance rules of  PHP version 5.4.5.

The issue has been logged as a bug:

http://framework.zend.com/issues/browse/ZF-12093

https://bugs.php.net/bug.php?id=55375

To fix the issue you need to override the file app\code\local\Zend\Pdf\FileParserDataSource.php.

Open the file and comment out the following lines

//abstract public function __construct();

//abstract public function __destruct();

This resolved our issue.

 

Comments

Leave a Comment

Back to top