Bug #11951 [Opn->WFx]: Assigning the return value of new by reference is deprecated

From: Date: Mon, 14 Sep 2009 14:10:25 +0000
Subject: Bug #11951 [Opn->WFx]: Assigning the return value of new by reference is deprecated
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-1625@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=11951&edit=1 ID: 11951 Updated by: cweiske@php.net Reported By: greg at gulik dot org Summary: Assigning the return value of new by reference is deprecated -Status: Open +Status: Wont fix Type: Bug Package: Spreadsheet_Excel_Writer Operating System: Linux (RHEL 5) Package Version: 0.9.1 PHP Version: 5.1.6 Roadmap Versions: New Comment: -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. Previous Comments: ------------------------------------------------------------------------ [2007-12-14 16:02:44] ajos2 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... ------------------------------------------------------------------------ [2007-08-31 15:14:55] berdir 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-08-31 12:45:41] ggulik 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 12:08:52] berdir 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 10:32:52] ggulik 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 ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=11951&edit=1

« previous php.pear.bugs (#1625) next »