Bug #18982 [Opn->Csd]: Non-static method Mail_mimePart::encodeHeader() should not be called statically

From: Date: Mon, 12 Mar 2012 14:04:56 +0000
Subject: Bug #18982 [Opn->Csd]: Non-static method Mail_mimePart::encodeHeader() should not be called statically
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8385@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=18982&edit=1 ID: 18982 Updated by: alec@alec.pl Reported By: vincents at itsolutions dot ie Summary: Non-static method Mail_mimePart::encodeHeader() should not be called statically -Status: Open +Status: Closed Type: Bug Package: Mail_Mime Operating System: linux Package Version: 1.8.2 PHP Version: 5.2.10 -Assigned To: +Assigned To: alec Roadmap Versions: New Comment: -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. Previous Comments: ------------------------------------------------------------------------ [2011-11-11 11:58:52] liverpoolfcfan 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; } ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=18982&edit=1

« previous php.pear.bugs (#8385) next »