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

Bug #19761 PHP-5.x warnings
Submitted: 2012-12-27 03:55 UTC Modified: 2013-06-24 11:13 UTC
From: mjo Assigned: alec
Status: Closed Package: Mail_Mime (version 1.8.7)
PHP Version: 5.4.6 OS:
Roadmaps: 1.8.8    
Subscription  


 [2012-12-27 03:55 UTC] mjo (Michael Orlitzky)
Description: ------------ Now that we've upgraded to php-5.4, I've noticed strict warnings for the assignments around line 900 in mime.php. Things like, $message =& $this->_addMixedPart(); where _addMixedPart is returning a reference: function _addMixedPart() { ... $ret = new Mail_mimePart('', $params); return $ret; } If I recall correctly, the behavior of new() was changed in php-5.0 to return a reference, and the above construct was deprecated through 5.3. In 5.4, it's a strict warning, and those are included in E_ALL. Rather than paper over them again , I'd prefer to fix our strict/deprecation warnings to reduce the amount of work needed to upgrade in the future. The fix is simple: remove the ampersands. However this would break php-4 compatibility, so I leave it to your discretion.

Comments

 [2013-05-07 11:07 UTC] sevencode (Seven Code)
I second this ticket as I'm sure the silent majority does as well. Its so annoying having my server send me complaints about this, that I've started itching to a switch to mutt, or some other mail library. I'd love to stay with Mail_Mime though. Why not just use phpversion() to determine whether to instantiate with the ampersand or not? That'd allow compatibility for both. function ShouldIRuntimeAmpersand() { // $v=phpversion(); $v=preg_replace("@\\.@",'',$v); while(StrLen($v)<5){$v.='0';} if($v<5400){ return true; } return false; } I fully admit I just made that function up without testing it, but you get the idea.
 [2013-06-24 09:39 UTC] alec (Aleksander Machniak)
If I'm not mistaken return by reference is still supported, but requires to use ampersand on function call and function definition. Then it should not produce a warning.
 [2013-06-24 10:33 UTC] alec (Aleksander Machniak)
-Status: Open +Status: Closed -Assigned To: +Assigned To: alec
This bug has been fixed in SVN. 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.
 [2013-06-24 11:13 UTC] alec (Aleksander Machniak)
-Type: Feature/Change Request +Type: Bug -Roadmap Versions: +Roadmap Versions: 1.8.8
 [2013-06-24 14:39 UTC] mjo (Michael Orlitzky)
Thank you! I see the repo has moved to github: https://github.com/pear/Mail_Mime That should make things easier. Next time I'll just send a pull request.