From: Chad Horohoe Date: Tue, 25 May 2010 13:25:37 +0000 (+0000) Subject: (bug 23648) PHP yells about using objects in implode(). Would be nice if __toString... X-Git-Tag: 1.31.0-rc.0~36735 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=0122b83933574d31b90700e1110e2378a1628309;p=lhc%2Fweb%2Fwiklou.git (bug 23648) PHP yells about using objects in implode(). Would be nice if __toString() was called like it should. (Supposedly was fixed in PHP6, meh) --- diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 99f99d2ef3..15d5f77b21 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -99,7 +99,7 @@ class UserMailer { * array of parameters. It requires PEAR:Mail to do that. * Otherwise it just uses the standard PHP 'mail' function. * - * @param $to MailAddress: recipient's email + * @param $to MailAddress: recipient's email (or an array of them) * @param $from MailAddress: sender's email * @param $subject String: email's subject. * @param $body String: email's text. @@ -112,6 +112,12 @@ class UserMailer { global $wgEnotifMaxRecips; if ( is_array( $to ) ) { + // This wouldn't be necessary if implode() worked on arrays of + // objects using __toString(). http://bugs.php.net/bug.php?id=36612 + foreach( $to as $t ) { + $emails .= $t->toString() . ","; + } + $emails = rtrim( $emails, ',' ); wfDebug( __METHOD__.': sending mail to ' . implode( ',', $to ) . "\n" ); } else { wfDebug( __METHOD__.': sending mail to ' . implode( ',', array( $to->toString() ) ) . "\n" );