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

Bug #19987 Only variables should be assigned by reference
Submitted: 2013-06-21 14:01 UTC
From: dimti Assigned: alec
Status: Closed Package: Mail_Mime (version 1.8.7)
PHP Version: 5.4.6 OS: Linux ubuntu
Roadmaps: 1.8.8    
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 : 37 - 5 = ?

 
 [2013-06-21 14:01 UTC] dimti (Alexander Demidov)
Description: ------------ Context In file /usr/share/php/Mail/mime.php, error at line 922 Only variables should be assigned by reference912 $this->_addAttachmentPart($message, $this->_parts[$i]); 913 } 914 break; 915 916 case $html && !$attachments && !$html_images: 917 if (isset($this->_txtbody)) { 918 $message =& $this->_addAlternativePart($null); 919 $this->_addTextPart($message, $this->_txtbody); 920 $this->_addHtmlPart($message); 921 } else { 922 $message =& $this->_addHtmlPart($null); 923 } 924 break; 925 926 case $html && !$attachments && $html_images: 927 // * Content-Type: multipart/alternative; 928 // * text 929 // * Content-Type: multipart/related; 930 // * html 931 // * image... 932 if (isset($this->_txtbody)) { Prepend that code, wrote: $this->_checkParams(); $null = null; $attachments = count($this->_parts) ? true : false; $html_images = count($this->_html_images) ? true : false; $html = strlen($this->_htmlbody) ? true : false; $text = (!$html && strlen($this->_txtbody)) ? true : false; After - call func _addHtmlPart($null) /** * Adds a html subpart to the mimePart object and * returns it during the build process. * * @param mixed &$obj The object to add the part to, or * null if a new object is to be created. * * @return object The html mimePart object * @access private */ function _addHtmlPart(&$obj) https://github.com/pear/Mail_Mime/blob/master/Mail/mime.php Test script: --------------- Why "NULL" - try to assigned by reference? Expected result: ---------------- Fatal error in my system Actual result: -------------- NULL not assigned by reference.

Comments

 [2013-06-21 14:08 UTC] dimti (Alexander Demidov)
Sorry - Expected result: its normal work that script Mail_Mime Actual result - Fatal error in my system
 [2013-06-21 14:42 UTC] alec (Aleksander Machniak)
But $null is a variable. What if you set it to e.g. 0 instead of null?
 [2013-06-21 14:45 UTC] alec (Aleksander Machniak)
Maybe it complains about the ampersand character before function call? Try to disable E_STRICT error reporting. But this shouldn't be a fatal error.
 [2013-06-22 13:19 UTC] dimti (Alexander Demidov)
if no txtbody, then the function _addHtmlPart () is passed $null (equal to null: $null = null). Why in the PEAR repository is the code that does not work on some level error reporting (E_STRICT) - if we disable this error rate, we might miss something important. Do not you think it's a little strange that the package Mail_Mime,. which implements the core functionality of our system, there are errors of incorrect use of the transfer value by reference. Interperator PHP tells us that we can not pass null here. -Why will not solve the problem, rather than trying to get rid of her symptoms?
 [2013-06-24 13:08 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.