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

Bug #5333 Only variables should be returned by reference; triggers notices since php 4.4.0
Submitted: 2005-09-08 11:38 UTC
From: matl-pear at jijenik dot com Assigned: cipri
Status: Closed Package: Mail_Mime
PHP Version: 4.4.0 OS: XP
Roadmaps: 1.4.0, 1.4.0a1    
Subscription  


 [2005-09-08 11:38 UTC] matl-pear at jijenik dot com
Description: ------------ Since upgrading to php 4.4.0, the mime.php script triggers some notices: Notice: Only variable references should be returned by reference in ...path...\mime.php on line 341 Notice: Only variable references should be returned by reference in ...path...\mime.php on line 593 I have display_errors = On set in php.ini This is the revision string of the mimi.php file // $Id: mime.php,v 1.39 2005/06/13 21:24:16 cipri Exp $ Test script: --------------- simply including the mail.php should trigger the notices being displayed.

Comments

 [2005-09-08 17:40 UTC] florent at creative-area dot net
same problem with php 4.4.0 on Linux : Notice: Only variable references should be returned by reference in /wwwroot/php/lib/php/Mail/mime.php on line 375 Notice: Only variable references should be returned by reference in /wwwroot/php/lib/php/Mail/mime.php on line 416 Notice: Only variable references should be returned by reference in /wwwroot/php/lib/php/Mail/mime.php on line 416 Notice: Only variable references should be returned by reference in /wwwroot/php/lib/php/Mail/mime.php on line 593
 [2005-09-09 06:54 UTC] matl-pear at jijenik dot com
I found some more info and a (kludgy) workaround for this issue. Each of the four problematic lines contains a statement in the form "return new SomeClass()". For some reason you cannot return a pointer to a newly created instance since PHP 4.4.0 (there is some documentation on that in the PHP release notes). the kludy workaround: replace the "return new SomeClass()" statement by these two lines: $newObj =& new SomeClass(); return $newObj; Wel, what can I say? PHP is a messy language :)
 [2005-09-16 08:30 UTC] demianturner
@@ -589,8 +590,8 @@ $headers = array_merge($headers, $xtra_headers); } $this->_headers = array_merge($headers, $this->_headers); - - return $this->_encodeHeaders($this->_headers); + $tmp = $this->_encodeHeaders($this->_headers); + return $tmp; }
 [2005-12-07 19:17 UTC] phyre at rogers dot com
Still remains unfixed for three months? We're into PHP5.1 these days, so these warnings really shouldn't be occuring as the error reporting and strict standards continues to increase. This and other errors in particular with E_STRICT on.
 [2006-02-02 14:47 UTC] cipri
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Bug #6260 was a duplicate of this. Bug #6663 was a duplicate of this.
 [2006-02-20 11:36 UTC] winkler at multimedia dot cz (jan winkler)
'the fix' still does not eliminate all the notices, the return statement in Mail_mime::headers() on line 598 of mime.php for instance.
 [2006-02-20 19:01 UTC] cipri
Oops. Please check the newly commited version 1.41 in CVS and see if that fixes all problems?
 [2006-02-22 13:04 UTC] j dot svoboda at phoenix dot cz
Version 1.41 still gives errors on line 444. PHP Notice: Only variable references should be returned by reference in /usr/local/lib/php/Mail/mime.php on line 444
 [2006-02-28 18:21 UTC] vasilyev at cliffgear dot com (Sergey Vasilyev)
Current (v 1.41 2006/02/20) version of mime.php still has some problems with returning by reference: *function &_addHtmlImagePart(&$obj, $value) and function &_addAttachmentPart(&$obj, $value): these function do not return a value, which is a problem since you can't return NULL by reference. *function &get($build_params = null) can return false constant value, which is also a problem
 [2006-03-14 19:09 UTC] cipri
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Please try the new version in CVS (1.42), as I don't have access to any PHP5 servers to try it myself.
 [2006-03-20 13:24 UTC] j dot svoboda at phoenix dot cz (Josef Svoboda)
Function &_addAttachmentPart(&$obj, $value) still does not return value. (v 1.42 2006/03/14)
 [2006-03-20 14:00 UTC] cipri (Cipriano Groenendal)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Could've sworn I added them all. Fixed in version mime.php Revision 1.43 in CVS
 [2006-04-01 22:18 UTC] busby at edoceo dot com (Edoceo, Inc.)
I'm using PHP 5 and tried the latest CVS versions of Mail_Mime and Mail packages, there were notices/warnings about using public/private and still some 'return by reference' issues. I hacked up a few of the files to get it to work for me, not a highly professional fix, just quick and dirty. Patches here: http://www.edoceo.com/busby/patches/pearmail.php (I didn't know if it's cool to push in big diffs so I just linked it)
 [2006-06-08 15:55 UTC] alan dot harder at sun dot com (Alan Harder)
When will a stable release include the return by reference fixes?
 [2006-07-17 12:04 UTC] koto at webworkers dot pl (Krzysztof Kotowicz)
Is there any progress in releasing the next version of the package with CVS patches?
 [2006-11-22 16:18 UTC] ota (Lx)
Soo what about people without cvs access? Is mail mime dead?
 [2006-12-20 17:22 UTC] davhana at hotmail dot com (David)
Its neary 2007 and the problem still exists..... Is this problem going to be fixed or is this package dead? Will someone please update the status of this package.
 [2007-01-13 14:23 UTC] rob at someplace dot com (rob)
This problem isn't solved yet: If I try to use the mail_queue package (on PHP 5.2) the following two notices still appear: Notice: Only variable references should be returned by reference in C:\Program Files\PHP\PEAR\Mail\mime.php on line 320 Notice: Only variable references should be returned by reference in C:\Program Files\PHP\PEAR\Mail\mime.php on line 593
 [2007-02-13 21:17 UTC] adul at shadow-lands dot net (Adul)
I used the below work around to get it working for me. I am going to move away from mail mime as I have found a better package to use. For those of you still having issues try out swiftmailer. http://www.swiftmailer.org "I found some more info and a (kludgy) workaround for this issue. Each of the four problematic lines contains a statement in the form "return new SomeClass()". For some reason you cannot return a pointer to a newly created instance since PHP 4.4.0 (there is some documentation on that in the PHP release notes). the kludy workaround: replace the "return new SomeClass()" statement by these two lines: $newObj =& new SomeClass(); return $newObj; Wel, what can I say? PHP is a messy language :)"