+91-943-185-6038 me@shashidharkumar.com

magentoIn one of my Magento projects, on development environment everything was working fine but when the site was live “Invoice” print in magento admin[Admin>>Sales>>Orders>>Invoice>>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 appcodelocalZendPdfFileParserDataSource.php.
Open the file and comment out the following lines
//abstract public function __construct();
//abstract public function __destruct();
This resolved my issue.

OR
Fixed it by change in this function lib/Zend/Pdf/FileParserDataSource.php.
change
abstract public function __construct();
to
abstract public function __construct($filePath);
This resolved my issue.

See also  Get Current URL