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

Bug #18982 Non-static method Mail_mimePart::encodeHeader() should not be called statically
Submitted: 2011-11-11 16:58 UTC
From: liverpoolfcfan Assigned: alec
Status: Closed Package: Mail_Mime (version 1.8.2)
PHP Version: 5.2.10 OS: linux
Roadmaps: (Not assigned)    
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 : 41 - 39 = ?

 
 [2011-11-11 16:58 UTC] liverpoolfcfan (Vincent Sherwood)
Description: ------------ When using a slightly modified version of Mail_mime (to remove the PEAR logging dependency) I get warnings/errors in my log files when making the following call $output->mimedata = $body.$mimemsg>txtheaders()."\n".$mimemsg->get(); The log file gets the following messages (note the line numbers reported will not match the 1.8.2 line numbers as a result of the local changes) 11/11/2011 10:25:28 [ 9631] [vincents] [ERROR] trace error: /var/www/html/z-push-2/backend/zimbra/mime.php:1296 Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context (2048) - backtrace: 8 steps 11/11/2011 10:25:28 [ 9631] [vincents] [ERROR] trace: 1:/var/www/html/z-push-2/backend/zimbra/mime.php:1275 - Mail_mime->encodeHeader() 11/11/2011 10:25:28 [ 9631] [vincents] [ERROR] trace: 2:/var/www/html/z-push-2/backend/zimbra/mime.php:1072 - Mail_mime->_encodeHeaders() 11/11/2011 10:25:28 [ 9631] [vincents] [ERROR] trace: 3:/var/www/html/z-push-2/backend/zimbra/mime.php:1091 - Mail_mime->headers() 11/11/2011 10:25:28 [ 9631] [vincents] [ERROR] trace: 4:/var/www/html/z-push-2/backend/zimbra/zimbra.php:2984 - Mail_mime->txtHeaders() This is as a result of the mime.php function function encodeHeader($name, $value, $charset, $encoding) { return Mail_mimePart::encodeHeader( $name, $value, $charset, $encoding, $this- >_build_params['eol'] ); } making a static call to mimepart.php encodeHeader. The suggested fix for this is to create a Mail_mimepart() object in the function encodeHeader, and to call it's endoceHeader method as follows :- function encodeHeader($name, $value, $charset, $encoding) { // return Mail_mimePart::encodeHeader( // $name, $value, $charset, $encoding, $this- >_build_params['eol'] // ); // VJS - commented out above code, and replaced with below to eliminate STRICT warnings $myPart = new Mail_mimePart(); $myHeader = $myPart->encodeHeader( $name, $value, $charset, $encoding, $this- >_build_params['eol'] ); unset( $myPart ); return $myHeader; }

Comments

 [2012-03-12 18:04 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. Mail_mime->encodeHeader() is deprecated don't use it. Fixed in git.