From 0122b83933574d31b90700e1110e2378a1628309 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 25 May 2010 13:25:37 +0000 Subject: [PATCH] (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) --- includes/UserMailer.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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" ); -- 2.20.1