Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.4

Bug #11951 Assigning the return value of new by reference is deprecated
Submitted: 2007-08-31 14:32 UTC
From: ggulik Assigned:
Status: Wont fix Package: Spreadsheet_Excel_Writer (version 0.9.1)
PHP Version: 5.1.6 OS: Linux (RHEL 5)
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 28 - 12 = ?

 
 [2007-08-31 14:32 UTC] ggulik (Gregory Gulik)
Description: ------------ After I upgraded to RHEL 5 which includes PHP 5.1.6 I cannot successfully produce an Excel file. I get the following errors: Error Number : 2048 Message : Assigning the return value of new by reference is deprecated File Name : /usr/share/pear/Spreadsheet/Excel/Writer/Workbook.php Line Number : 186 Error Number : 2048 Message : Assigning the return value of new by reference is deprecated File Name : /usr/share/pear/Spreadsheet/Excel/Writer/Workbook.php Line Number : 195 Test script: --------------- Error is produced upon loading the module. Actual result: -------------- Error Number : 2048 Message : Assigning the return value of new by reference is deprecated File Name : /usr/share/pear/Spreadsheet/Excel/Writer/Workbook.php Line Number : 195

Comments

 [2007-08-31 16:08 UTC] berdir (Sascha Grossenbacher)
This is a E_STRICT Message. It is often not possible to create a package which is compatible to PHP4 AND PHP5 with E_STRICT. So, unless there is a PHP5-only version of this package (which is unlikely at the moment), you have to disable E_STRICT in your php.ini with error_reporting = E_ALL or in your code with error_reporting(E_ALL) Or, if you use a custom error_handler, set the second parameter to E_ALL: set_error_handler('YourErrorHandler', E_ALL);
 [2007-08-31 16:45 UTC] ggulik (Gregory Gulik)
Thanks for the prompt response. However error reporting on this system is already as follows: error_reporting = E_ALL & ~E_NOTICE I understand that this not include E_STRICT as it is. Even with that the module cannot produce a readable Excel file. I have tried it with both Office XP and OpenOffice 2.1, both complain the file is an unreadable format.
 [2007-08-31 19:14 UTC] berdir (Sascha Grossenbacher)
Your error message doesn't look like the default one, I think you are using your own error handler. Such an error handler is not affected by the error_reporting setting, you need to set this explicity with the second parameter of set_error_handler. The following line activates your error handler only for the actual setting: set_error_handler('MyErrorHandler', error_reporting()); See http://ch2.php.net/manual/en/function.set-error-handler.php for more information about this.
 [2007-12-14 21:02 UTC] ajos2 (Antony OSullivan)
I also have this message... and I have to have Strict turned on... Strict Standards: Assigning the return value of new by reference is deprecated in /usr/share/pear/Spreadsheet/Excel/Writer/Workbook.php on line 186 Strict Standards: Assigning the return value of new by reference is deprecated in /usr/share/pear/Spreadsheet/Excel/Writer/Workbook.php on line 195 I found that changing: $this->_parser =& new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version); $this->_tmp_format =& new Spreadsheet_Excel_Writer_Format($this->_BIFF_version); To: $this->_parser = new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version); $this->_tmp_format = new Spreadsheet_Excel_Writer_Format($this->_BIFF_version); Seems to work... Ie =& is now = A long term solution would be helpful... as I have to keep remembering to change this file on new servers...
 [2009-09-14 19:10 UTC] cweiske (Christian Weiske)
-Status: Open +Status: Wont fix
Spreadsheet_Excel_Writer is compatible to PHP4, thus the code cannot be changed. When you do not use your own error handler, it works.