Edit report at http://pear.php.net/bugs/bug.php?id=12071&edit=1

ID: 12071
Comment by: pahan@hubbitus.spb.su
Reported By: dninja at gmail dot com
Summary: Error message: Assigning the return value of new by
reference is deprecated
Status: Wont fix
Type: Bug
Package: Mail
Operating System: arch linux
Package Version: 1.1.14
PHP Version: 5.2.4
Assigned To: chagenbu
Roadmap Versions:
New Comment:

In any case call nonstatic methods in static context is bad idea - it
will be prohibited in the future versions of PHP.

Previous Comments:

[2009-12-30 16:48:49] magnamel

Hi hubbitus,
thank your for your reply about my question
I have tried to call back the parseAddressList method in static
I know that this is not correct but with a E_ALL & ~E_NOTICE error
level in php.ini the error is disappeared again.
The code in Mail.php is now the follow:

//$parser =& new Mail_RFC822();
$addresses = Mail_RFC822::parseAddressList($value, 'localhost',

Is this PHP4 compatible?



[2009-12-27 13:48:04] hubbitus

magnamel - there no problem removing this ampersand in PHP5 but it
breaks backward capability with php4. I can say must be removed for
PHP5. In easy way it may be wrapped to oark in both.


[2009-12-27 09:54:06] magnamel

I am very interested to PEAR project but i am a very new user of php
For try, I have removed the ampersand (&) in front off operator 'new'
at line 154 of Mail.php file. The error is disappeared
What kind of problem missing & can do?

Package Mail version 1.1.14
Php version 5.3.0
OS version Mac OS X 10.6 with XAMPP 1.7.2a installed



[2009-08-27 11:55:16] shadow_man

I wait too.

But 1/3 packages was make for PHP5 and lots of package have make since
3 yers ago...


[2009-07-19 21:30:46] torrentss

You can use the following workaround:

function & ref_new(&$new_statement)
return $new_statement;

So, instead of writing:
$o =& new ClassName();
you write:
$o =& ref_new(new ClassName());
which gets rid of the warning but still avoids copying under PHP4.


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
postedJan 8, '10 at 2:45a
activeJan 8, '10 at 2:45a

1 user in discussion

Pahan: 1 post



site design / logo © 2022 Grokbase