Zend error while trying to create/print PDF invoices Print

  • 1

When you move your account from one server to another, it's of utmost importance that the configurations of those servers match. A mismatch could always lead to potential problems to many features in your website.

Once such instance, is encountering the following error, when attempting to create/print off an invoice for a customer from the invoice page under Sales from your Magento panel

Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct() in {Path to FileParserDataSource/File.php}

This typically happens when the account was running on a server with an earlier version of PHP (in this case it was PHP 5.3), and the current server runs on PHP 5.4.4 and is triggered by an incompatibility issue between PHP Version 5.4.4 and the Zend Framework.

Solution 1:-

You can fix this by commenting out two lines of codes used to define constructor and destructor methods in the file lib/Zend/Pdf/FileParserDataSource.php (// is how we normally comment out a line in a php file, after which the lines would look like)

// abstract public function __construct();

// abstract public function __destruct();

Solution 2:-

By changing __construct() and __destruct() function methods in lib/Zend/Pdf/FileParserDataSource.php as follows (which essentially provides the path of the file explicitly)


abstract public function __construct();


abstract public function __construct($filePath);

Technical Details:-

This seems to be essentially a problem with the implementation of stricter inheritance rule in the framework as described in:


And it is all about a PHP bug as reported in here:


Was this answer helpful?

« Back