Magento PHP 5.4 PDF invoice Zend error

Hidde picture Hidde · Oct 22, 2013 · Viewed 10.7k times · Source

Magento is throwing a PHP error when I'm trying to create PDF invoices (because my client is running PHP 5.4.19).

Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct() in /var/www/vhosts/website/httpdocs/includes/src/Zend_Pdf_FileParserDataSource_File.php on line 41

Normally it's easy to fix this by editing the FileParserDataSource.php and commenting out two lines, the problem is that they run a Zend_Pdf_FileParserDataSource_File.php that extends this script (http://pastebin.com/J64VNsRP).

Is there any solution available so that's possible to create PDF invoices with Magento on a server running PHP 5.4?

Answer

Mufaddal picture Mufaddal · Oct 23, 2013

This an incompatibility issue between PHP Version 5.4.4 and zend Framwork .

Fixed it by change in this function lib/Zend/Pdf/FileParserDataSource.php.

change

abstract public function __construct();

to

abstract public function __construct($filePath);