FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17866&edit=1

ID: 17866
Updated by: alec@alec.pl
Reported By: myguitar82 at hotmail dot com
Summary: Non-static method Mail_RFC822::parseAddressList
called statically
-Status: Open
+Status: Closed
Type: Bug
Package: Mail
Operating System: Linux
Package Version: 1.2.0
PHP Version: 5.3.2
-Assigned To:
+Assigned To: alec
-Roadmap Versions:
+Roadmap Versions: 1.2.1
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: alec
-Roadmap Versions:
+Roadmap Versions: 1.2.1
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.




Previous Comments:
------------------------------------------------------------------------

[2010-09-14 13:43:11] myguitar82

Added #patch
bug:17866;patch:Mail-nonstatic-function;revision:1284471791;.

------------------------------------------------------------------------

[2010-09-14 13:40:27] myguitar82

Description:
------------
When running with E_STRICT:

The non-static member function Mail_RFC822::parseAddressList is being
called statically as shown below.

$addresses = Mail_RFC822::parseAddressList($recipients, 'localhost',
false);

This object needs to be instantiated in order to use this member
function as shown below. This avoids unnecessary PHP warnings.

$Mail_RFC822 = new Mail_RFC822();
$addresses = $Mail_RFC822->parseAddressList($recipients, 'localhost',
false);


Test script:
---------------
<?php

require_once 'Mail.php';
require_once 'PEAR.php';

define('SMTP_SERVER', 'smtp.somewhere.net');
define('SMTP_PORT', 25);
define('USERNAME', 'someone');
define('PASSWORD', '1LamePassword');

$objMail = new Mail;

$objSMTP = $objMail->factory('smtp',
array (
'host' => SMTP_SERVER,
'port' => SMTP_PORT,
'auth' => true,
'username' => USERNAME,
'password' => PASSWORD));

$strFromEmail = "someone@somewhere.net";
$strFromName = "Some One";
$strToAddress = "SoAndSo@somewhere.net";

$aHeaders['From'] = "{$strFromName} <{$strFromEmail}>";
$aHeaders['To'] = $strToAddress;
$aHeaders['Subject'] = "Test Message";

$objMail = $objSMTP->send($strToAddress, $aHeaders, "Hello world.");

if(PEAR::isError($objMail))
{
print "Error sending user message: " . $objMail->getMessage();
return false;
}
else
return true;
?>


Expected result:
----------------
ERROR: #2048 - Non-static method Mail_RFC822::parseAddressList() should
not be called statically, assuming $this from incompatible context
occurred in Mail.php on line 253

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 14, '11 at 7:07p
activeJan 14, '11 at 7:07p
posts1
users1
websitepear.php.net

1 user in discussion

Alec: 1 post

People

Translate

site design / logo © 2022 Grokbase