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

Bug #9956 Notices being thrown
Submitted: 2007-01-27 03:32 UTC
From: lturmelle at guamcell dot com Assigned: cipri
Status: Closed Package: Mail_Mime (version 1.3.1)
PHP Version: 5.1.4 OS: xp sp2
Roadmaps: 1.4.0, 1.4.0a1    
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 : 50 - 6 = ?

 
 [2007-01-27 03:32 UTC] lturmelle at guamcell dot com (Ligaya Turmelle)
Description: ------------ Various places in the class are now throwing E_NOTICE for returning executed code instead of a variable. This is with E_STRICT turned off in this PHP version. Have also had the error thrown on lines 356 and 434 - though not on the provided test script. Test script: --------------- <?php error_reporting(E_ALL); require 'Mail.php'; require 'Mail/mime.php'; $mime = new Mail_mime("\r\n"); $mime->setTXTBody('Howdy'); $body = $mime->get(); $hdrs = $mime->headers(array( 'From' => 'lig@mydomain.com', 'Subject' => 'Howdy' ) ); $mail = Mail::factory('smtp', array('host'=>'smtp.myisp.net')); echo ($mail->send('lig@anotherdomain.com', $hdrs, $body)) ? 'TRUE' : 'FALSE'; ?> Expected result: ---------------- TRUE Actual result: -------------- <br /> <b>Notice</b>: Only variable references should be returned by reference in <b>C:\php\PEAR\Mail\mime.php</b> on line <b>320</b><br /> <br /> <b>Notice</b>: Only variable references should be returned by reference in <b>C:\php\PEAR\Mail\mime.php</b> on line <b>593</b><br /> TRUE

Comments

 [2007-01-29 10:37 UTC] lturmelle at guamcell dot com
I haven't used PHP4 OO in a long time and these are a bit ugly - but they seem to work for me. Here is a few patches for this report : mime.php Line 356 - return new Mail_mimePart('', $params); + $var = &new Mail_mimePart('', $params); + return $var; mime.php Line 320 - return new Mail_mimePart($text, $params); + $var = &new Mail_mimePart($text, $params); + return $var; mime.php Line 593 - $this->_headers = array_merge($headers, $this->_headers); - return $this->_encodeHeaders($this->_headers); + $var = array_merge($headers, $this->_headers); + $this->_headers = $var; + $var2 = &$this->_encodeHeaders($this->_headers); + return $var2;
 [2007-01-30 16:38 UTC] m at mattanjakern dot de (Mattanja Kern)
Same problem here... Is this package maintained no longer? Full diff for that problem should be the following. --- mime.php.old 2007-01-30 19:11:22.000000000 +0100 +++ mime.php 2007-01-30 19:14:14.000000000 +0100 @@ -317,7 +317,8 @@ if (is_object($obj)) { return $obj->addSubpart($text, $params); } else { - return new Mail_mimePart($text, $params); + $tmp = &new Mail_mimePart($text, $params); + return $tmp; } } @@ -338,7 +339,8 @@ if (is_object($obj)) { return $obj->addSubpart($this->_htmlbody, $params); } else { - return new Mail_mimePart($this->_htmlbody, $params); + $tmp = &new Mail_mimePart($this->_htmlbody, $params); + return $tmp; } } @@ -353,7 +355,8 @@ function &_addMixedPart() { $params['content_type'] = 'multipart/mixed'; - return new Mail_mimePart('', $params); + $tmp = &new Mail_mimePart('', $params); + return $tmp; } /** @@ -372,7 +375,8 @@ if (is_object($obj)) { return $obj->addSubpart('', $params); } else { - return new Mail_mimePart('', $params); + $tmp = &new Mail_mimePart('', $params); + return $tmp; } } @@ -392,7 +396,8 @@ if (is_object($obj)) { return $obj->addSubpart('', $params); } else { - return new Mail_mimePart('', $params); + $tmp = &new Mail_mimePart('', $params); + return $tmp; } } @@ -590,7 +595,9 @@ } $this->_headers = array_merge($headers, $this->_headers); - return $this->_encodeHeaders($this->_headers); + $tmp = $this->_encodeHeaders($this->_headers); + $tmp_p = &$tmp; + return $tmp_p; } /**
 [2007-02-14 13:00 UTC] bretrzaun at hotmail dot com (Bret R. Zaun)
Same problem here - would like to get an new release instead of patching the file. Is anyone listening ?
 [2007-03-08 00:30 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. Dup of Bug #5333 And yes, a new release is forthcoming!
 [2007-05-05 15:07 UTC] cipri (Cipriano Groenendal)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Mail_Mime Fixed in 1.4.0