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?
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);
This is zend core issue http://framework.zend.com/issues/browse/ZF-12093. fix it by commenting out __construct
and __destruct
methods in lib/Zend/Pdf/FileParserDataSource.php
// abstract public function __construct();
/**
* Object destructor. Closes the data source.
*
* May also perform cleanup tasks such as deleting temporary files.
*/
// abstract public function __destruct();`
Sometimes it may be solve by recompile compiler or disable compiler.
Go to System > Tools > Compilation page and click on Run Compilation Process
button or Disable
button.
Now check print invoice.
http://kb.magenting.com/content/24/81/en/disable-magento-compiler.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With