Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - blank/empty page when printing invoice on backend

I am working on Magento 1.5, and when I try to print any of my invoices, on the backend, I got a white/empty page.

I've tried to debug this step by step, the problem is that I can't put the error_reporting on (I'm on a production mode)

Update:

[Mon Jun 10 12:35:53 2013] [error] [client 196.203.53.248] PHP Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct() in /home/webmaster/public_html/www/lib/Zend/Pdf/FileParserDataSource/File.php on line 41, referer: http://www.example.com/index.php/admin/sales_invoice/view/invoice_id/15/

like image 866
t.c Avatar asked Jun 10 '13 11:06

t.c


3 Answers

Edit

lib/Zend/Pdf/FileParserDataSource.php

change

abstract public function __construct();

to

abstract public function __construct($filePath);
like image 99
Michael Leiss Avatar answered Oct 21 '22 10:10

Michael Leiss


This is an incompatibility issue between PHP Version 5.4.4-14 and Zend Framwork.

Fixed 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(); 

Thank you !

like image 30
t.c Avatar answered Oct 21 '22 11:10

t.c


Mischa Leiss's and Rastaking's fixes are completely correct, thought I would like to add that editing the file at

[magento root]/lib/Zend/Pdf/FileParserDataSource.php 

is not best practice. Better to copy the file to

[magento root]/app/code/local/Zend/Pdf/FileParserDataSource.php

and edit the file there. Magento will use this overriding version of the file, instead of the default, and you are less likely to run into issues in the future (like when you try to upgrade Magento core).

Also, this probably should have been a comment, but it was difficult to read without formatting.

like image 6
siliconrockstar Avatar answered Oct 21 '22 10:10

siliconrockstar