r66871 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66870‎ | r66871 | r66872 >
Date:13:25, 25 May 2010
Author:demon
Status:ok
Tags:
Comment:
(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)
Modified paths:
  • /trunk/phase3/includes/UserMailer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/UserMailer.php
@@ -99,7 +99,7 @@
100100 * array of parameters. It requires PEAR:Mail to do that.
101101 * Otherwise it just uses the standard PHP 'mail' function.
102102 *
103 - * @param $to MailAddress: recipient's email
 103+ * @param $to MailAddress: recipient's email (or an array of them)
104104 * @param $from MailAddress: sender's email
105105 * @param $subject String: email's subject.
106106 * @param $body String: email's text.
@@ -112,6 +112,12 @@
113113 global $wgEnotifMaxRecips;
114114
115115 if ( is_array( $to ) ) {
 116+ // This wouldn't be necessary if implode() worked on arrays of
 117+ // objects using __toString(). http://bugs.php.net/bug.php?id=36612
 118+ foreach( $to as $t ) {
 119+ $emails .= $t->toString() . ",";
 120+ }
 121+ $emails = rtrim( $emails, ',' );
116122 wfDebug( __METHOD__.': sending mail to ' . implode( ',', $to ) . "\n" );
117123 } else {
118124 wfDebug( __METHOD__.': sending mail to ' . implode( ',', array( $to->toString() ) ) . "\n" );

Status & tagging log